#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
//#include <sstream>
using namespace std;
unsigned getDigits(unsigned int value) {
return value > 0 ? (int) log10 ((double) value) + 1 : 1;
}
string toString(int val, int a) {
string res;
for (int i = 0; i < a; i++) {
res += (char)val % 10;
val /= 10;
}
reverse(res.begin(), res.end());
return res;
}
int main() {
int amount;
cin >> amount;
int *a = new int[amount];
int cur;
int index;
int size;
int digits;
string result;
for (int i = 0; i < amount; i++) {
cin >> a[i];
}
for (int i = 0; i < amount; i++) {
cur = a[i];
index = 1;
size = 0;
digits = 0;
//stringstream ss;
for (; size <= cur; index++) {
digits = getDigits(index);
//ss << index;
result += toString(index);
size += digits;
}
cout << result.at(cur - 1) << '\n';
}
//while (1);
return 0;
}