#include<bits/stdc++.h>
using namespace std;
 
 
 
#define int long long
 


int mod = 998244353;
const int maxn = 3e5+100;

int zero = 0;


 
 
 
signed main(){
	int t;
	cin>>t;
	while(t--){
		int x,y;
		cin>>x>>y;
		int ans = 2*min(x,y)+ max(abs(x-y)*2-1,zero);
		cout<<ans<<endl;
	}
	return 0;
}
