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

#define print(a)          \
    for (auto x : a)      \
        cout << x << " "; \
    cout << endl
#define print_upto(a, n)        \
    for (int i = 0; i < n; i++) \
        cout << a[i] << " ";    \
    cout << endl
#define take(x, n)              \
    for (int i = 0; i < n; i++) \
        cin >> x[i];

#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x, y) cout << (#x) << " is " << (x) << " and " << (#y) << " is " << (y) << "\n"
#define watch3(x, y, z) cout << (#x) << " is " << (x) << " and " << (#y) << " is " << (y) << " and " << (#z) << " is " << (z) << "\n"

#define ll long long
#define ff first
#define ss second
#define null NULL
#define all(c) (c).begin(), (c).end()
#define nl "\n"

#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front
#define mod 1000000007
#define pi 3.14159265358979323846
#define precise(x) cout << fixed << setprecision(10) << x

typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<ll, ll> pll;
typedef unordered_map<ll, ll> umpll;

int main()
{

    // Use ctrl+shift+b ( second option )
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll t = 1;
    cin >> t;

    while (t--)
    {
        ll x, y;
        cin >> x >> y;

        ll ans1 = 0, ans2 = 0;
        if (x == 1)
        {
            ans1 = 0;
            ans2 = y;
        }
        else if (x == y)
        {
            ans1 = x - 1;
            ans2 = x;
        }
        else if (x > y)
        {
            ans2 = y;
            ans1 = x - 1;
        }
        else
        {
            ans1 = x - 1;
            ans2 = y;
        }

        cout << ans1 << " " << ans2 << nl;
    }

    return 0;
}
