讨论。
#include<bits/stdc++.h> #define int long long #define double long double #define x first #define y second using namespace std; typedef long long LL; typedef long long ll; typedef pair<int, int> PII; const int N = 3e5 + 10; const int M = 1e3 + 10; int mod = 1e9 + 7; // int a[N]; void solve() { int a, b; cin >> a >> b; if (a == 0 && b == 0) { cout << 1 << " " << 1 << "\n"; return ; } if (a == 0) { cout << 2 * b << " " << b << "\n"; return ; } if (b == 0) { cout << a << " " << a * 2 << "\n"; return ; } if (b > a) { cout << a + b << " " << b << "\n"; return ; } else if (a > b) { cout << a << " " << a + b << "\n"; return ; } cout << -1 << " " << -1 << "\n"; } signed main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int _; _ = 1; cin >> _; while (_--) { solve(); } }