#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

int level[6][2]={{100,85},{84,80},{79,75},{74,70},{69,60},{59,0}};

int main()
{
    int T_T;
    scanf("%d",&T_T);
    while(T_T--)
    {
        int f,n;
        double mi=20.,mx=-20.;
        scanf("%d%d",&f,&n);
        for(int l1=0;l1<=n;l1++)
        {
            int res1=n-l1;
            for(int l2=0;l2<=res1;l2++)
            {
                int res2=n-l1-l2;
                for(int l3=0;l3<=res2;l3++)
                {
                    int res3=n-l1-l2-l3;
                    for(int l4=0;l4<=res3;l4++)
                    {
                        int res4=n-l1-l2-l3-l4;
                        for(int l5=0;l5<=res4;l5++)
                        {
                            int l6=0;
                          //  printf("%d %d %d %d %d %d \n",l1,l2,l3,l4,l5,l6);
                            int minsorce=level[0][1]*l1+level[1][1]*l2+level[2][1]*l3+
                            level[3][1]*l4+level[4][1]*l5+level[5][1]*l6;
                            int maxsorce=level[0][0]*l1+level[1][0]*l2+level[2][0]*l3+
                            level[3][0]*l4+level[4][0]*l5+level[5][0]*l6;
                           // printf("%d %d %d %d %d %d \n",level[0][0]*l1,level[1][0]*l2,level[2][0]*l3,
                           // level[3][0]*l4,level[4][0]*l5,level[5][0]);
                           // cout<<minsorce<<" <---> "<<maxsorce<<endl;
                            if(f*n<=maxsorce&&f*n>=minsorce)
                            {
                                 mi=min(mi,(4.*l1+3.5*l2+3.*l3+2.5*l4+2.*l5)/n);
                                mx=max(mx,(4.*l1+3.5*l2+3.*l3+2.5*l4+2.*l5)/n);
                                if((4.*l1+3.5*l2+3.*l3+2.5*l4+2.*l5)/n<=2.000)
                                {
                                cout<<"mi: "<<mi<<endl;
                                printf("%d %d %d %d %d %d \n",l1,l2,l3,l4,l5,l6);
                                cout<<"credit: "<<4.*l1+3.5*l2+3.*l3+2.5*l4+2.*l5<<endl;
                                cout<<minsorce<<" <-"<< f*n <<"--> "<<maxsorce<<endl;

                                }
                            }
                        }
                    }
                }
            }
        }
        printf("%.4lf %.4lf\n",mi,mx);
    }
    return 0;
}