#include <bits/stdc++.h>
int main() {
  int T;
  int N;
  scanf("%d", &T);
  for (int slot = 1; slot <= T; slot++) {
    scanf("%d", &N);
  }
  int c, total, r, sum = 0;
  int store[200], i = 0, L, M = 0;
  int loop;
  total = N;
  for (int x = T; x > 0; x--) {
    for (i = 0; i < 200; i++) {
      while (total > 0) {
        r = total % 10;
        sum = sum + r;
        total /= 10;
      }
    }
    sum = L;
    i += M;
    store[i] = L;
  }
  for (loop = 0; loop <= T; loop++) printf("%d\n", store[loop]);
  return 0;
}
