#include<iostream>
#include<vector>
#include<string>
#include<math.h> 
#include<algorithm> 
#include<stdio.h> 
#include<fstream>  
using namespace std; 
typedef long long ll; 
typedef long double ld; 


char nl = '\n'; 
char bl = ' ';
const int MOD = 1e9 + 7; 

int main(){

ios_base::sync_with_stdio(false);
cin.tie(NULL); 
 int t; 
 cin >> t; 
 while(t--){
     int x,y; 
     cin >> x >> y; 

     if(abs(x - y) <= 1){
         cout << x + y << nl; 
     }
     else{
         cout << abs(x - y) - 1 + x + y << nl; 
     }
 }


}

