#include<bits/stdc++.h>
#define lowbit(i) ((i)&(-(i)))
#define lson(i) ((i)<<1)
#define rson(i) ((i)<<1|1)
#define sqr(x) ((x)*(x))
#define fi first
#define se second
#define mp(x,y) make_pair((x),(y))
#define pb push_back
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef pair<int,int> pii;
typedef vector<int> vii;
typedef vector<pii> vpi;
typedef queue<int> qii;

const int inf=0x3f3f3f3f;
const int maxn=100005;


int main(){
	int T;
	cin>>T;
	while(T--){
		int x,y;
		cin>>x>>y;
		int t=abs(x-y);
		if(t==0){
			cout<<x+y<<endl;
		}
		else{
			cout<<min(x,y)*2+(t-1)*2+1<<endl;
		}
	} 
	return 0;
}

