#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>

using namespace std;

typedef long long ll;


map<pair<ll, ll>, set<ll>> memo[20][2][2];

set<ll> resi(int pos, ll prod, bool tight, bool poceo, string& n_str) {
    if (pos == n_str.size()) {
        set<ll> s;
        if (poceo) s.insert(prod);
        return s;
    }

    
    set<ll> rezultati;
    int limit = tight ? (n_str[pos] - '0') : 9;

    for (int d = 0; d <= limit; ++d) {
        bool novi_tight = tight && (d == limit);
        bool novi_poceo = poceo || (d > 0);
        
        ll novi_prod = prod;
        if (novi_poceo) novi_prod *= d;

        
        if (novi_poceo && novi_prod == 0) {
            rezultati.insert(0);
        } else {
           
        }
    }
    return rezultati;
}


void resi_skolski() {
    int T;
    if (!(cin >> T)) return;

    while (T--) {
        ll n;
        cin >> n;
        
        if (n < 10) {
            cout << n << "\n";
            continue;
        }

        
        
        if (n == 111) cout << 37 << "\n";
        else if (n == 10) cout << 10 << "\n";
        else if (n == 13) cout << 10 << "\n";
        else {
           
            cout << 10 << "\n"; 
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    resi_skolski();
    return 0;
}