#include<iostream>using namespace std;int main(){ int a,b=10,c,sum=0,d; cin>>a; for(int i=1;i<=a;i++) { cin>>c; for(int g=1;g<=c;g++) { d=b/17; sum+=d; b=b%17; b=b*10; } cout<<d<<" "<<sum<<endl; sum=0;d=0;b=10; } return 0;}