#include<iostream>
using namespace std;
int main()
{
	int t,a,b,x,y;
	cin >> t;
	for(int i = 0;i<t;i++)
	{
		cin >> x >>y;
		if(x<=y)
		{
			a = y-x;
			if(a ==1||a==0)
			{
				b = x+y;
			}
			else
			{
				b = (x*2)+(a-1+a);
			}
			cout<< b<<endl;
		}
		if(y<x)
		{
				a = x - y;
			if(a ==1||a==0)
			{
				b = x+y;
			}
			else
			{
				b = (y*2)+(a-1+a);
			}
			cout<< b<<endl;
		}	
	}
 } 
