#include<iostream>
using namespace std;
int n,q;
struct st{
	int len;
	string mem,memnew;
}rep[200009],old[200009];
int main(){
	cin>>n>>q;
	freopen("replace.in","r",stdin);
	freopen("replace.out","w",stdout);
	for(int i=1;i<=n;i++){
		cin>>rep[i].mem>>rep[i].memnew;
		rep[i].len=rep[i].mem.length();
	}
	sort(nlen+1,nlen+n+1);
	for(int i=1;i<=1;i++){
		cin>>old[i].mem>>old[i].memnew;
		old[i].len=old[i].mem.length();
	}
	for(int i=1;i<=q;i++){
		for(int j=1;j<=n;j++){
			if(old.memnew.substr())
		}
	}
} 
