#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int M=998244353;
void printv(vector<ll>&a){
for(int i=0;i<a.size();i++){
cout<<a[i]<<" ";
}
}
ll binpow(ll a, ll b) {
if (b == 0)
return 1;
long long res = binpow(a, b / 2);
if (b % 2){
long long temp=((res%M) * (res%M))%M;
return ((temp%M)*a)%M;
}
else
return ((res%M) * (res%M))%M;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
ll t=1;
cin>>t;
while(t--){
ll n,m,k;
cin>>n;
vector<pair<ll,ll>>traps;
for(int i=0;i<n;i++){
cin>>m>>k;
traps.push_back({m,k-1});
}
sort(traps.begin(),traps.end());
ll maxi=traps[0].first+traps[0].second/2;
for(int i=1;i<traps.size();i++){
maxi=min(maxi,traps[i].first+traps[i].second/2);
}
cout<<maxi<<endl;
}
}
706B - Interesting drink | 1265A - Beautiful String |
214A - System of Equations | 287A - IQ Test |
1108A - Two distinct points | 1064A - Make a triangle |
1245C - Constanze's Machine | 1005A - Tanya and Stairways |
1663F - In Every Generation | 1108B - Divisors of Two Integers |
1175A - From Hero to Zero | 1141A - Game 23 |
1401B - Ternary Sequence | 598A - Tricky Sum |
519A - A and B and Chess | 725B - Food on the Plane |
154B - Colliders | 127B - Canvas Frames |
107B - Basketball Team | 245A - System Administrator |
698A - Vacations | 1216B - Shooting |
368B - Sereja and Suffixes | 1665C - Tree Infection |
1665D - GCD Guess | 29A - Spit Problem |
1097B - Petr and a Combination Lock | 92A - Chips |
1665B - Array Cloning Technique | 1665A - GCD vs LCM |