#include <bits/stdc++.h>
#define ll long long

using namespace std;

int t, x, y;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> t;
    while (t--){
        cin >> x >> y;
        int ans = min(x, y) * 2 + abs(x - y) * 2;
        if (x^y) ans--;
        cout << ans << '\n';
    }

    return 0;
}
