#include <iostream>
#include <iomanip>
using namespace std;
const int MAXN = 10001;
int main() {
int nums[MAXN];
int i = 1, cur = 19;
while (i < MAXN) {
int n = cur;
int sum = 0;
while (n) {
sum += n % 10;
n /= 10;
}
if (sum == 10) {
nums[i++] = cur;
}
cur++;
}
int T;
cin >> T;
while (T--) {
int idx;
cin >> idx;
cout << nums[idx] << endl;
}
return 0;
}