#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  cin >> n >> m;
  int i, j, k;
  int pairsSame1 = 0, pairsDiff1 = 0, pairsSame2 = 0, pairsDiff2 = 0;
  int red = n;
  int blue = m;
  int arr[n + m];
  arr[0] = 1;
  red--;
  int chance = 1;
  for (i = 1; i < n + m; i++) {
    if (chance == 1) {
      chance = 0;
      if (arr[i - 1] == 1) {
        if (blue != 0) {
          arr[i] = 0;
          blue--;
          pairsDiff1++;
        } else {
          arr[i] = 1;
          red--;
          pairsSame1++;
        }
      } else {
        if (red != 0) {
          arr[i] = 1;
          red--;
          pairsDiff1++;
        } else {
          arr[i] = 0;
          blue--;
          pairsSame1++;
        }
      }
    } else {
      chance = 1;
      if (arr[i - 1] == 1) {
        if (red != 0) {
          arr[i] = 1;
          red--;
          pairsSame1++;
        } else {
          arr[i] = 0;
          blue--;
          pairsDiff1++;
        }
      } else {
        if (blue != 0) {
          arr[i] = 0;
          blue--;
          pairsSame1++;
        } else {
          arr[i] = 1;
          red--;
          pairsDiff1++;
        }
      }
    }
  }
  red = n;
  blue = m;
  arr[0] = 0;
  blue--;
  chance = 1;
  for (i = 1; i < n + m; i++) {
    if (chance == 1) {
      chance = 0;
      if (arr[i - 1] == 1) {
        if (blue != 0) {
          arr[i] = 0;
          blue--;
          pairsDiff2++;
        } else {
          arr[i] = 1;
          red--;
          pairsSame2++;
        }
      } else {
        if (red != 0) {
          arr[i] = 1;
          red--;
          pairsDiff2++;
        } else {
          arr[i] = 0;
          blue--;
          pairsSame2++;
        }
      }
    } else {
      chance = 1;
      if (arr[i - 1] == 1) {
        if (red != 0) {
          arr[i] = 1;
          red--;
          pairsSame2++;
        } else {
          arr[i] = 0;
          blue--;
          pairsDiff2++;
        }
      } else {
        if (blue != 0) {
          arr[i] = 0;
          blue--;
          pairsSame2++;
        } else {
          arr[i] = 1;
          red--;
          pairsDiff2++;
        }
      }
    }
  }
  if (pairsSame1 > pairsSame2) {
    cout << pairsSame1 << " " << pairsDiff1;
  } else {
    cout << pairsSame2 << " " << pairsDiff2;
  }
}
