#include <bits/stdc++.h>
using namespace std;

#define TASKNAME "ideal"

void init() {
//#if __GLIBCXX__ == 20160609
#ifdef KEK
    freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#else
    ///freopen(TASKNAME".in", "r", stdin);
    ///freopen(TASKNAME".out", "w", stdout);
#endif
}
#define pb push_back
#define fi first
#define se second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const double EPS = 1e-9;
const int INF = (int)1e9 + 41;
const int N = (int)1e6 + 34;
const ll LINF = (ll)1e18 + 41;


void solve() {
    int x, y;
    cin >> x >> y;
    int ans = 0;
    int n = min(x, y);
    int rest = max(x, y) - n;
    ans += n * 2;
    while (rest) {
        ans++;
        rest -= 1;
        if (!rest)
            break;
        ans++;
    }
    cout  << ans <<  '\n';
}

int main() {
    init();
    cin.tie(nullptr);
    iostream::sync_with_stdio(false);
    int t;
    cin >> t;
    while (t--)
        solve();

    return 0;
}
