#include <bits/stdc++.h>
using namespace std;
// #Placement #Strings
/*
testcase:
seeaaioooudf
falakehojopry
output:
aaeoo
*/
bool isVow(char a);
string LCS(string a, string b);
int main(){
char ws;
int t;
cin>>t;
ws=cin.get();
while (t--) {
string a;
string b;
cin>>a;
cin>>b;
cout<<LCS(a,b)<<endl;
}
return 0;
}
string LCS(string a, string b){
string ans;
map<char, pair<int,int> > m;
for(int i=0;i<a.size();i++){
if(isVow(a[i])==true){
(m[a[i]].first)++;
}
}
for(int i=0;i<b.size();i++){
if(isVow(b[i])==true){
(m[b[i]].second)++;
}
}
for(auto it=m.begin();it!=m.end();it++){
int rep=min((it->second).first,(it->second).second);
while(rep--){
ans.push_back(it->first);
}
}
return ans;
}
bool isVow(char a){
if(a=='a'|| a=='e' || a=='i' || a=='o' ||a=='u'){
return true;
}
return false;
}