#include <iostream>

using namespace std;

int main()
{
long  n;
cin>>n;
long a[n],b[n];

for(long  i=0;i<n;i++)
cin>>a[i]>>b[i];

for(long  i=0;i<n;i++)
{
    if(a[i]==0 && b[i]==0)
    {
        cout<<0<<endl;
    }
    else
    {
         if(a[i]==b[i])
        cout<<a[i]+b[i]<<endl;
        else
        {
            cout<<a[i]+b[i]+(max(a[i],b[i])-min(a[i],b[i])-1)<<endl;
        }
    }
}

}
