#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, k, x;     cin >> n;     for (long long i = 0; i < n; i++) {       cin >> k >> x;       cout << x + (k - 1) * 9 << endl;     }   }   