#include <bits/stdc++.h>
using namespace std;
char asciitolower(char in) {
  if (in <= 'Z' && in >= 'A') return in - ('Z' - 'z');
  return in;
}
char delete_glas(char in) {
  vector<char> b({'a', 'o', 'y', 'e', 'u', 'i'});
  for (char i : b) {
    if (in == i) {
      return 'a';
    }
  }
  return in;
}
void solve() {
  vector<int> a(2);
  int last = 0;
  for (int h = 0; h < a.size(); h++) {
    cin >> a[h];
  };
  sort(a.begin(), a.end());
  vector<int> a1 = a;
  a[0]--;
  int ans1 = 0, ans2 = 0;
  const int n = a[0] + a[1];
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      int next = last ^ 1;
      if (a[next] == 0) {
        if (i == 0)
          ans2++;
        else
          ans1++;
        a[last]--;
      } else {
        ans2++;
        a[next]--;
        last ^= 1;
      }
    } else {
      int next = last;
      if (a[next] == 0) {
        ans2++;
        last ^= 1;
        a[last]--;
      } else {
        ans1++;
        a[last]--;
      }
    }
  }
  int ans11 = 0, ans22 = 0;
  a = a1;
  a[1]--;
  last = 1;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      int next = last ^ 1;
      if (a[next] == 0) {
        if (i == 0)
          ans22++;
        else
          ans11++;
        a[last]--;
      } else {
        ans22++;
        a[next]--;
        last ^= 1;
      }
    } else {
      int next = last;
      if (a[next] == 0) {
        ans22++;
        last ^= 1;
        a[last]--;
      } else {
        ans11++;
        a[last]--;
      }
    }
  }
  if (ans1 > ans11) {
    cout << ans1 << " " << ans2 << '\n';
  } else {
    cout << ans11 << " " << ans22 << '\n';
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
}
