#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const int maxn=1e6+10;
#define mod 1000000007
int main(){
	fast;
	ll t,a,b; cin>>t;
	while(t--){
		cin>>a>>b;
		if(abs(a-b)<=1){
			cout<<a+b<<'\n';
			continue;
		}else{
			ll mn=min(a,b),mx=max(a,b);
			ll tt=mn;
			mn+=2;
			cout<<tt+mn+1+(mx-mn)*2<<'\n';
		}
	}	
	return 0;
}
// combnatorics(pigeonhole principle, stars and bars (n+k-1)C(k-1))
// comparator in inbuilt sorting 
// lcs
// period of a string(prefix-function) with KMP
// prime func
// subset production
// factorization
// modpow
// modinv ( a^(p-2)=a^(-1) (mod p) )
// sieve
// ncr
// euler totien func (co prime divisiors upto n)
// matrix exponentation(fast fibonacci)
// dsu
// Trees
// Graphs(dfs,bfs,shortes path etc.)
// DP-Recursion