#include<bits/stdc++.h>
using namespace std;
#define M_PI  3.1415926535
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define Summon_Tourist ios::sync_with_stdio(false);cin.tie(0);
ll gcd(ll a , ll b) { return b==0?a: gcd( b, a%b); }
ll lcm(ll a , ll b) { return a/gcd(a,b) * b ; }
ll inf = 1e9;
ll modexp( ll base ,ll power)
 {
     if( power == 0  ) return 1;
     if( power & 1) return base*modexp( base , power-1 )%inf;
     return modexp(base*base%inf,power/2);
 }
 int main()
{
  Summon_Tourist


  //freopen("input.txt" , "r" , stdin ) ;
  ll t = 1;
  cin>>t;
  while(t--)
  {
      ll x,y; cin>>x>>y;

      ll a = min( x,y );
      ll b = max( x,y ) - a ;
      ll ans = a*2;
      if( b!=0 ) ans += (b-1)*2;
      if( b!=0 ) ans++;
      cout<<ans<<endl;
  }
  return 0;
}
