#include <bits/stdc++.h>
using namespace std;
int l[220100];
int main() {
  int a, b;
  cin >> a >> b;
  if (a > b) {
    swap(a, b);
  }
  int ans1 = 0;
  int ans2 = 0;
  if (a == 1) {
    ans1 = b - 1;
    ans2 = 1;
  } else {
    int t = a / 2 * 2;
    a -= t;
    b -= t;
    ans1 += t - 1;
    ans2 += t;
    if (a == 1) {
      ans1 += b;
      ans2++;
    } else {
      ans1 += b;
    }
  }
  cout << ans1 << " " << ans2 << endl;
  return 0;
}
