def removeDuplicates(kywrd):
  text="";
  vowels = ('a', 'e', 'i', 'o', 'u','A','E','I','O','U');
  for char_index in range(len(kywrd)):
    if(not (char_index+1 < len(kywrd) and kywrd[char_index]==kywrd[char_index+1] and not kywrd[char_index] in vowels)):
      text = text + kywrd[char_index]
  temp = text[1::]
  for c in text:
        if c in vowels:
            temp = temp.replace(c,""); 
  text = text[0:1:] + temp
  return text

def eliminateChars(expr):
 ls = expr.split(' ')
 keyword1=ls[0]
 keyword2=ls[1]
 str1 = removeDuplicates(keyword1)
 str2 = removeDuplicates(keyword2)
 tStr1=""
 tStr2=""
 pos=0
 for x1, x2 in zip(str1, str2):
   if( x1!=x2):
     tStr1= tStr1+x1
     tStr2= tStr2+x2
   pos=pos+1
 str1 = tStr1 + str1[pos::]
 str2 = tStr2  + str2[pos::]
 tStr1=""
 tStr2=""
 pos=0
 for x1, x2 in zip(reversed(str1), reversed(str2)):
   if( x1!=x2):
     tStr1= tStr1+x1
     tStr2= tStr2+x2
     
   pos=pos+1
 str1 = tStr1 + str1[pos::]
 str2 = tStr2  + str2[pos::]
 str1 = str1[::-1]
 str2 = str2[::-1]
 if(len(str1)len(str2)):
   print(expr, str2)
 else :
   wrdLst = []
   wrdLst.append(str1)
   wrdLst.append(str2)
   wrdLst.sort()
   print(expr,wrdLst[0])

count = 5 #no.of inputs
expression = []
print('Enter all valid Inputs')
for i in range(count):
  expression.append(input())
print('Output')
for str in expression:
  eliminateChars(str.upper())