#include <bits/stdc++.h>
using namespace std;
int main() {
  int r, b;
  cin >> r >> b;
  int n = r + b;
  int temp[r + b];
  int i = 0;
  bool petya = true;
  int tempR = r, tempB = b;
  while (tempR && tempB) {
    if (i == 0) {
      temp[i] = 'r';
      tempR--;
      i++;
      petya = false;
    } else if (petya) {
      if (temp[i - 1] == 'r') {
        temp[i] = 'r';
        tempR--;
      } else {
        temp[i] = 'b';
        tempB--;
      }
      petya = false;
      i++;
    } else {
      if (temp[i - 1] == 'r') {
        temp[i] = 'b';
        tempB--;
      } else {
        temp[i] = 'r';
        tempR--;
      }
      petya = true;
      i++;
    }
  }
  while (tempR) {
    temp[i] = 'r';
    tempR--;
    i++;
  }
  while (tempB) {
    temp[i] = 'b';
    tempB--;
    i++;
  }
  int ans1 = 0, ans2 = 0;
  for (int i = 0; i < n - 1; i++) {
    if (temp[i] == temp[i + 1])
      ans1++;
    else
      ans2++;
  }
  tempR = r;
  tempB = b;
  i = 0;
  while (tempR && tempB) {
    if (i == 0) {
      temp[i] = 'b';
      tempB--;
      i++;
      petya = false;
    }
    if (petya) {
      if (temp[i - 1] == 'r') {
        temp[i] = 'r';
        tempR--;
      } else {
        temp[i] = 'b';
        tempB--;
      }
      petya = false;
      i++;
    } else {
      if (temp[i - 1] == 'r') {
        temp[i] = 'b';
        tempB--;
      } else {
        temp[i] = 'r';
        tempR--;
      }
      petya = true;
      i++;
    }
  }
  while (tempR) {
    temp[i] = 'r';
    tempR--;
    i++;
  }
  while (tempB) {
    temp[i] = 'b';
    tempB--;
    i++;
  }
  int secondAns1 = 0, secondAns2 = 0;
  for (int i = 0; i < n - 1; i++) {
    if (temp[i] == temp[i + 1])
      secondAns1++;
    else
      secondAns2++;
  }
  if (ans1 > secondAns1) {
    cout << ans1 << " " << ans2 << endl;
  } else if (secondAns1 > ans1)
    cout << secondAns1 << " " << secondAns2 << endl;
  else if (secondAns1 == ans1) {
    if (ans2 <= secondAns2)
      cout << ans1 << " " << ans2 << endl;
    else {
      cout << secondAns1 << " " << secondAns2 << endl;
    }
  }
}
