#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int total;
  int tg;
  int turn, i, pre, first, second;
  int first2, second2;
  int current;
  int tgn, tgm;
  cin >> n >> m;
  total = n + m;
  tgn = n;
  tgm = m;
  turn = 2;
  i = 2;
  pre = 0;
  n = n - 1;
  first = 0;
  second = 0;
  while (i <= total) {
    if (n == 0) {
      current = 1;
      m = m - 1;
    } else if (m == 0) {
      current = 0;
      n = n - 1;
    } else if (n != 0 && m != 0) {
      if (turn == 1) {
        if (pre == 0) {
          current = 0;
          n = n - 1;
        } else {
          current = 1;
          m = m - 1;
        }
      } else {
        if (pre == 1) {
          current = 0;
          n = n - 1;
        } else {
          current = 1;
          m = m - 1;
        }
      }
    }
    turn = turn + 1;
    turn = turn % 2;
    if (current == pre)
      first++;
    else
      second++;
    pre = current;
    i++;
  }
  n = tgn;
  m = tgm;
  turn = 2;
  i = 2;
  pre = 1;
  m = m - 1;
  first2 = 0;
  second2 = 0;
  while (i <= total) {
    if (n == 0) {
      current = 1;
      m = m - 1;
    } else if (m == 0) {
      current = 0;
      n = n - 1;
    } else if (n != 0 && m != 0) {
      if (turn == 1) {
        if (pre == 0) {
          current = 0;
          n = n - 1;
        } else {
          current = 1;
          m = m - 1;
        }
      } else {
        if (pre == 1) {
          current = 0;
          n = n - 1;
        } else {
          current = 1;
          m = m - 1;
        }
      }
    }
    turn = turn + 1;
    turn = turn % 2;
    if (current == pre)
      first2++;
    else
      second2++;
    pre = current;
    i++;
  }
  if (first > first2)
    cout << first << " " << second << "\n";
  else
    cout << first2 << " " << second2 << "\n";
}
