#include <bits/stdc++.h>
using namespace std;
const int inf = 0xfffffff;
long long m, n, sum[1005][1005], used[1005][1005], a[20005];
long long gcd(long long a, long long b) {
  long long c;
  while (b) {
    c = b;
    b = a % b;
    a = c;
  }
  return a;
}
int cn(int a) {
  int ans = 0;
  while (a) {
    a /= 10;
    ans++;
  }
  return ans;
}
int main() {
  long long ans, res;
  int k;
  while (cin >> n) {
    string s, s1;
    int sg = 0;
    while (n--) {
      cin >> k;
      s = "";
      sg = 0;
      for (int i = 1;; i++) {
        s += to_string(i);
        sg += cn(i);
        if (k > sg)
          k -= sg;
        else {
          cout << s[k - 1] << endl;
          break;
        }
      }
    }
  }
}
