#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
int N, M, ans[200100], n, m;
int main() {
  cin >> N >> M;
  n = m = 0;
  ans[0] = 0;
  n++;
  for (int(i) = 1; (i) <= (N + M - 1); (i)++) {
    if (i & 1) {
      if (ans[i - 1]) {
        if (n < N) {
          ans[i] = 0;
          n++;
        } else {
          ans[i] = 1;
          m++;
        }
      } else {
        if (m < M) {
          ans[i] = 1;
          m++;
        } else {
          ans[i] = 0;
          n++;
        }
      }
    } else {
      if (ans[i - 1]) {
        if (m < M) {
          ans[i] = 1;
          m++;
        } else {
          ans[i] = 0;
          n++;
        }
      } else {
        if (n < N) {
          ans[i] = 0;
          n++;
        } else {
          ans[i] = 1;
          m++;
        }
      }
    }
  }
  int s11 = 0;
  int s12 = 0;
  for (int(i) = 1; (i) <= (N + M - 1); (i)++) {
    if (ans[i - 1] == ans[i])
      s11++;
    else
      s12++;
  }
  n = m = 0;
  ans[0] = 1;
  m++;
  for (int(i) = 1; (i) <= (N + M - 1); (i)++) {
    if (i & 1) {
      if (ans[i - 1]) {
        if (n < N) {
          ans[i] = 0;
          n++;
        } else {
          ans[i] = 1;
          m++;
        }
      } else {
        if (m < M) {
          ans[i] = 1;
          m++;
        } else {
          ans[i] = 0;
          n++;
        }
      }
    } else {
      if (ans[i - 1]) {
        if (m < M) {
          ans[i] = 1;
          m++;
        } else {
          ans[i] = 0;
          n++;
        }
      } else {
        if (n < N) {
          ans[i] = 0;
          n++;
        } else {
          ans[i] = 1;
          m++;
        }
      }
    }
  }
  int s21 = 0;
  int s22 = 0;
  for (int(i) = 1; (i) <= (N + M - 1); (i)++) {
    if (ans[i - 1] == ans[i])
      s21++;
    else
      s22++;
  }
  if (s11 < s21) {
    cout << s21 << " " << s22 << endl;
  } else {
    cout << s11 << " " << s12 << endl;
  }
}
