include "stdafx.h"
#include<iostream>
#include<string>
using namespace std;
int main()
{
int num;
cin >> num;
while (num!=0)
{
num--;
string str;
// getline(cin,str);
cin >> str;
int flag = 0;
for (int i = 0;i < str.length();i++)
{
bool result = true;
for (int j = 0;j < str.length();j++)
{
/* cout << "i:" << i<<" ";
cout << "j:" << j << endl;*/
if (i == j) continue;
if (str[i] == str[j])
{
// cout << "执行了" << endl;
result = false;
break;
}
}
if (result == true)
{
// cout << "执行了" << endl;
flag = i;
// cout << "flag:"<<flag << endl;
break;
// cout << str[i] << endl;
}
}
cout << str[flag] << endl;
}
return 0;
}