#include <bits/stdc++.h>
using namespace std;
const int dr[]{-1, -1, 0, 1, 1, 1, 0, -1};
const int dc[]{0, 1, 1, 1, 0, -1, -1, -1};
void run() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
vector<int> solve(vector<int> cnt, int last) {
  bool b = 1;
  vector<int> point(2);
  while (cnt[0] + cnt[1] > 0) {
    last ^= b;
    if (cnt[last])
      cnt[last]--, point[b]++;
    else
      cnt[!last]--, last = !last, point[!b]++;
    b ^= 1;
  }
  return point;
}
int main() {
  run();
  int n, m;
  cin >> n >> m;
  vector<int> out = max(solve({n - 1, m}, 0), solve({n, m - 1}, 1));
  cout << out[0] << ' ' << out[1] << "\n";
}
