#include <iostream>
#include <random>
#include <fstream>
#include <iterator>
#include <algorithm>
#include <cassert>
#include <iomanip>
#include <ctime>
#include <functional>
using namespace std;
const int MOD = 998244353;
#define LL long long
// LL seed = chrono::steady_clock::now().time_since_epoch().count();
// mt19937_64 rng(seed);
// #define rand(l, r) uniform_int_distribution<LL>(l, r)(rng)
// clock_t start = clock();
#define getchar getchar_unlocked
namespace IO {
long long readInt(char endd) {
long long ret = 0;
char c = getchar();
while (c != endd) {
ret = (ret * 10) + c - '0';
c = getchar();
}
return ret;
}
long long readInt(long long L, long long R, char endd) {
long long ret = readInt(endd);
assert(ret >= L && ret <= R);
return ret;
}
long long readIntSp(long long L, long long R) {
return readInt(L, R, ' ');
}
long long readIntLn(long long L, long long R) {
return readInt(L, R, '\n');
}
string readString(int l, int r, char endd = '\n') {
string ret = "";
char c = getchar();
while (c >= '0' && c <= '9') {
ret += c;
c = getchar();
}
assert(c == endd);
assert((int)ret.size() >= l && (int)ret.size() <= r);
return ret;
}
}
using namespace IO;
const int TMAX = 1000;
const int NMAX = 1000;
bool got = false;
int digSum(int n) {
if (n <= 0) return n;
return n % 10 + digSum(n / 10);
}
void solve() {
int n = readIntLn(1, (int)1e9);
int x = n + 1;
while (digSum(x) % 2 == digSum(n) % 2) ++x;
cout << x << '\n';
assert(x == n + 1 || x == n + 2);
if (x == n + 2) got = true;
// cerr << "assertion ok\n";
}
int main() {
int T = readIntLn(1, 1000);
while (T--) solve();
assert(got);
assert(getchar() == EOF);
cerr << fixed << setprecision(10);
// cerr << (clock() - start) / ((long double)CLOCKS_PER_SEC) << " secs\n";
return 0;
}