#include using namespace std; typedef long long LL; #define F(N,S,T) for(int N=(S);N<=(T);N++) int calc(int b,int c){ return (200001*c+100*b)/(200*b+2*c); } void work(){ int n; cin>>n; int ans=-1e9; while(n--){ int b; double c; cin>>b>>c; ans=max(ans,calc(b,round((1-c)*100))); } printf("%d.%05d\n",ans/100000,ans%100000); } int main(){ ios::sync_with_stdio(false); int t; cin>>t; while(t--){ work(); } return 0; }