#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;
}
}