#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <iterator>
using namespace std;
struct node{
map<char, int> next;
int cnt=0;
};
struct tr{
vector<node> go;
tr(){
go.resize(1);
}
void add_str(string &s){
int q=0;
for(char ch: s){
if(!go[q].next.count(ch)){
go[q].next[ch]=go.size();
q=go.size();
go.resize(go.size()+1);
}
else{
go[q].next[ch];
}
}
++go[q].cnt;
}
};
bool dfs(vector<string> &grid, vector<vector<int>> &used, int i, int j, vector<node> &go, int q){
if(used[i][j]){
return false;
}
used[i][j]=1;
if(go[q].cnt){
--go[q].cnt;
return true;
}
int n=used.size(), m=used[0].size();
if(i<n-1 && go[q].next.count(grid[i+1][j])){
bool res=dfs(grid, used, i+1, j, go, go[q].next[grid[i+1][j]]);
if(res){
return true;
}
}
if(i>0 && go[q].next.count(grid[i-1][j])){
bool res=dfs(grid, used, i-1, j, go, go[q].next[grid[i-1][j]]);
if(res){
return true;
}
}
if(j<m-1 && go[q].next.count(grid[i][j+1])){
bool res=dfs(grid, used, i, j+1, go, go[q].next[grid[i][j+1]]);
if(res){
return true;
}
}
if(j>0 && go[q].next.count(grid[i][j-1])){
bool res=dfs(grid, used, i, j-1, go, go[q].next[grid[i][j-1]]);
if(res){
return true;
}
}
used[i][j]=0;
return false;
}
int main()
{
int n, m, p; cin>>n>>m>>p;
vector<string> grid(n);
vector<vector<int>> used(n, vector<int> (m, 0));
tr trie;
for(int i=0; i<n; ++i)
cin>>grid[i];
for(int i=0; i<p; ++i){
string s; cin>>s;
trie.add_str(s);
}
for(int i=0; i<n; ++i)
for(int j=0; j<m; ++j)
if(trie.go[0].next.count(grid[i][j]))
dfs(grid, used, i, j, trie.go, trie.go[0].next[grid[i][j]]);
vector<char> ans;
for(int i=0; i<n; ++i)
for(int j=0; j<m; ++j)
if(!used[i][j])
ans.push_back(grid[i][j]);
sort(ans.begin(), ans.end());
copy(ans.begin(), ans.end(), ostreambuf_iterator<char>(cout));
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8aXRlcmF0b3I+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IG5vZGV7CiAgICBtYXA8Y2hhciwgaW50PiBuZXh0OwogICAgaW50IGNudD0wOwp9OwoKc3RydWN0IHRyewogICAgdmVjdG9yPG5vZGU+IGdvOwogICAgdHIoKXsKICAgICAgICBnby5yZXNpemUoMSk7CiAgICB9CiAgICB2b2lkIGFkZF9zdHIoc3RyaW5nICZzKXsKICAgICAgICBpbnQgcT0wOwogICAgICAgIGZvcihjaGFyIGNoOiBzKXsKICAgICAgICAgICAgaWYoIWdvW3FdLm5leHQuY291bnQoY2gpKXsKICAgICAgICAgICAgICAgIGdvW3FdLm5leHRbY2hdPWdvLnNpemUoKTsKICAgICAgICAgICAgICAgIHE9Z28uc2l6ZSgpOwogICAgICAgICAgICAgICAgZ28ucmVzaXplKGdvLnNpemUoKSsxKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlewogICAgICAgICAgICAgICAgZ29bcV0ubmV4dFtjaF07CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgKytnb1txXS5jbnQ7CiAgICB9Cn07CgoKYm9vbCBkZnModmVjdG9yPHN0cmluZz4gJmdyaWQsIHZlY3Rvcjx2ZWN0b3I8aW50Pj4gJnVzZWQsIGludCBpLCBpbnQgaiwgdmVjdG9yPG5vZGU+ICZnbywgaW50IHEpewogICAgaWYodXNlZFtpXVtqXSl7CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfQogICAgdXNlZFtpXVtqXT0xOwogICAgaWYoZ29bcV0uY250KXsKICAgICAgICAtLWdvW3FdLmNudDsKICAgICAgICByZXR1cm4gdHJ1ZTsKICAgIH0KCiAgICBpbnQgbj11c2VkLnNpemUoKSwgbT11c2VkWzBdLnNpemUoKTsKCiAgICBpZihpPG4tMSAmJiBnb1txXS5uZXh0LmNvdW50KGdyaWRbaSsxXVtqXSkpewogICAgICAgIGJvb2wgcmVzPWRmcyhncmlkLCB1c2VkLCBpKzEsIGosIGdvLCBnb1txXS5uZXh0W2dyaWRbaSsxXVtqXV0pOwogICAgICAgIGlmKHJlcyl7CiAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgIH0KICAgIH0KCiAgICBpZihpPjAgJiYgZ29bcV0ubmV4dC5jb3VudChncmlkW2ktMV1bal0pKXsKICAgICAgICBib29sIHJlcz1kZnMoZ3JpZCwgdXNlZCwgaS0xLCBqLCBnbywgZ29bcV0ubmV4dFtncmlkW2ktMV1bal1dKTsKICAgICAgICBpZihyZXMpewogICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICB9CiAgICB9CgogICAgaWYoajxtLTEgJiYgZ29bcV0ubmV4dC5jb3VudChncmlkW2ldW2orMV0pKXsKICAgICAgICBib29sIHJlcz1kZnMoZ3JpZCwgdXNlZCwgaSwgaisxLCBnbywgZ29bcV0ubmV4dFtncmlkW2ldW2orMV1dKTsKICAgICAgICBpZihyZXMpewogICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICB9CiAgICB9CgogICAgaWYoaj4wICYmIGdvW3FdLm5leHQuY291bnQoZ3JpZFtpXVtqLTFdKSl7CiAgICAgICAgYm9vbCByZXM9ZGZzKGdyaWQsIHVzZWQsIGksIGotMSwgZ28sIGdvW3FdLm5leHRbZ3JpZFtpXVtqLTFdXSk7CiAgICAgICAgaWYocmVzKXsKICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgfQogICAgfQoKCiAgICB1c2VkW2ldW2pdPTA7CiAgICByZXR1cm4gZmFsc2U7Cn0KCmludCBtYWluKCkKewogICAgaW50IG4sIG0sIHA7IGNpbj4+bj4+bT4+cDsKCiAgICB2ZWN0b3I8c3RyaW5nPiBncmlkKG4pOwogICAgdmVjdG9yPHZlY3RvcjxpbnQ+PiB1c2VkKG4sIHZlY3RvcjxpbnQ+IChtLCAwKSk7CiAgICB0ciB0cmllOwoKICAgIGZvcihpbnQgaT0wOyBpPG47ICsraSkKICAgICAgICBjaW4+PmdyaWRbaV07CgogICAgZm9yKGludCBpPTA7IGk8cDsgKytpKXsKICAgICAgICBzdHJpbmcgczsgY2luPj5zOwogICAgICAgIHRyaWUuYWRkX3N0cihzKTsKICAgIH0KCiAgICBmb3IoaW50IGk9MDsgaTxuOyArK2kpCiAgICAgICAgZm9yKGludCBqPTA7IGo8bTsgKytqKQogICAgICAgICAgICBpZih0cmllLmdvWzBdLm5leHQuY291bnQoZ3JpZFtpXVtqXSkpCiAgICAgICAgICAgICAgICBkZnMoZ3JpZCwgdXNlZCwgaSwgaiwgdHJpZS5nbywgdHJpZS5nb1swXS5uZXh0W2dyaWRbaV1bal1dKTsKCiAgICB2ZWN0b3I8Y2hhcj4gYW5zOwogICAgZm9yKGludCBpPTA7IGk8bjsgKytpKQogICAgICAgIGZvcihpbnQgaj0wOyBqPG07ICsraikKICAgICAgICAgICAgaWYoIXVzZWRbaV1bal0pCiAgICAgICAgICAgICAgICBhbnMucHVzaF9iYWNrKGdyaWRbaV1bal0pOwoKICAgIHNvcnQoYW5zLmJlZ2luKCksIGFucy5lbmQoKSk7CgogICAgY29weShhbnMuYmVnaW4oKSwgYW5zLmVuZCgpLCBvc3RyZWFtYnVmX2l0ZXJhdG9yPGNoYXI+KGNvdXQpKTsKCgogICAgcmV0dXJuIDA7Cn0K