#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, t = 0, k, p, q;
  cin >> n >> m;
  k = n + m;
  p = n;
  q = m;
  char s[k], r[k];
  s[0] = '1';
  r[0] = '0';
  n--;
  q--;
  long long i = 1;
  while (n > 0 and m > 0) {
    if (t % 2 == 1) {
      if (s[i - 1] == '0')
        s[i] = '0', m--;
      else
        s[i] = '1', n--;
    } else {
      if (s[i - 1] == '1')
        s[i] = '0', m--;
      else
        s[i] = '1', n--;
    }
    t++;
    i++;
  }
  for (long long j = i; j < k; j++) {
    if (n)
      s[j] = '1', n--;
    else
      s[j] = '0', m--;
  }
  t = 0;
  i = 1;
  while (p > 0 and q > 0) {
    if (t % 2 == 1) {
      if (r[i - 1] == '0')
        r[i] = '0', q--;
      else
        r[i] = '1', p--;
    } else {
      if (r[i - 1] == '1')
        r[i] = '0', q--;
      else
        r[i] = '1', p--;
    }
    t++;
    i++;
  }
  for (long long j = i; j < k; j++) {
    if (p)
      r[j] = '1', p--;
    else
      r[j] = '0', q--;
  }
  long long a = 0, b = 0;
  for (long long i = 0; i < k - 1; i++) {
    if (s[i] != s[i + 1])
      a++;
    else
      b++;
  }
  long long c = 0, d = 0;
  for (long long i = 0; i < k - 1; i++) {
    if (r[i] != r[i + 1])
      c++;
    else
      d++;
  }
  if (d > b)
    cout << d << ' ' << c << endl;
  else
    cout << b << ' ' << a << endl;
  return 0;
}
