#include <bits/stdc++.h>
using namespace std;
#define turbo ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll long long
int main(){
	turbo;
    int tt=1;
    cin>>tt;
    while(tt--){
        int x,y;
        cin>>x>>y;
        if(x==0 && y==0) cout<<"0\n";
        else if(x==0 || y==0){
            if(x==0){
                cout<<2*y-1<<"\n";
            }
            else{
                cout<<2*x-1<<"\n";
            }
        }
        else if(x==y){
            cout<<2*x<<"\n";
        }
        else{
            if(x>y){
                int ans=2*y;
                x-=y;
                ans+=2*x-1;
                cout<<ans<<"\n";
            }
            else{
                int ans=2*x;
                y-=x;
                ans+=2*y-1;
                cout<<ans<<"\n";
            }
        }
    }
}