#55554: ans


yp11451032@yphs.tp.edu.tw (811-23吳嘉恩)


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t, n, q;
    cin >> t;
    while(t--){
        int s=0;
        int r=1;
        cin >> n;
        while(n--){
            r*=10;
            q=r/17;
            s+=q;
            r%=17;
        }
        cout << q << " " << s << endl;
    }
}