#include <bits/stdc++.h>
using namespace std;
map<int,int> mp;
int n,x;
int f()
{
int y=x/n;
x%=n;
x*=10;
return y;
}
int main()
{
int t;
cin>>t;
for(int tot=1;tot<=t;tot++)
{
scanf("%d",&n);
cout<<"0.";
x=10;
mp[x]=tot;
while(x<n) x*=10,cout<<"0",mp[x]=tot;
while(true)
{
printf("%d",f());
if(mp[x]==tot) break;
if(x==0) break;
mp[x]=tot;
}
cout<<"\n";
}
}