#include <iostream>
using namespace std;
int a[2701] , n , k;
int main()
{
int p = 1 , aux;
for(int i = 100 ; i <= 999 ; i++)
{
aux = i;
a[p++] = aux / 100;;
a[p++] = (aux / 10) % 10;
a[p++] = aux % 10;
}
cin >> n;
while(n -- )
{
cin >> k;
cout << a[k] << " ";
}
return 0;
}