#include<iostream>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--){
        int a,b;
        cin>>a>>b;
        if(a==0&&b==0)
            cout<<"0\n";
        else if(a==0&&b!=0)
            cout<<2*b-1<<endl;
        else if(a!=0&&b==0)
            cout<<2*a-1<<endl;
        else{
            if(a>b){
                int x=(2*b)+(2*(a-b)-1);
                cout<<x<<endl;
            }
            else if(a<b){
                int x=(2*a)+(2*(b-a)-1);
                cout<<x<<endl;
            }
            else if(a==b)
                cout<<2*a<<endl;
            }
        }
    }

