#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-11;
int n, m, k[2];
bool a[200200];
pair<int, int> ans = make_pair(-1, -1);
pair<int, int> f() {
  pair<int, int> tans = make_pair(0, 0);
  for (int i = 0; i < (n + m - 1); i++) {
    if (i % 2 == 0) {
      if (k[!a[i]]) {
        a[i + 1] = !a[i];
        k[!a[i]]--;
      } else {
        a[i + 1] = a[i];
        k[a[i]]--;
      }
    } else {
      if (k[a[i]]) {
        a[i + 1] = a[i];
        k[a[i]]--;
      } else {
        a[i + 1] = !a[i];
        k[!a[i]]--;
      }
    }
  }
  for (int i = 0; i < (n + m - 1); i++) {
    if (a[i] == a[i + 1])
      tans.first++;
    else
      tans.second++;
  }
  return tans;
}
int main() {
  cout << setiosflags(ios::fixed) << setprecision(10);
  cin >> n >> m;
  a[0] = 0;
  k[0] = n - 1;
  k[1] = m;
  ans = max(ans, f());
  a[0] = 1;
  k[0] = n;
  k[1] = m - 1;
  ans = max(ans, f());
  cout << ans.first << ' ' << ans.second << endl;
  return 0;
}
