#include <bits/stdc++.h>
using namespace std;
enum step { blue = false, red = true };
void moveRed(vector<step> &steps, int &redCount, int &blueCount) {
  if (redCount > 0) {
    steps.push_back(red);
    redCount--;
  } else {
    steps.push_back(blue);
    blueCount--;
  }
}
void moveBlue(vector<step> &steps, int &redCount, int &blueCount) {
  if (blueCount > 0) {
    steps.push_back(blue);
    blueCount--;
  } else {
    steps.push_back(red);
    redCount--;
  }
}
void playGame(vector<step> &steps, bool startWithRed, int redCount,
              int blueCount) {
  if (startWithRed) {
    steps.push_back(red);
    redCount--;
  } else {
    steps.push_back(blue);
    blueCount--;
  }
  int stepCount = redCount + blueCount;
  for (int step = 0; step < stepCount; step++) {
    if (step % 2 == 0) {
      if (steps.back() == red)
        moveBlue(steps, redCount, blueCount);
      else
        moveRed(steps, redCount, blueCount);
    } else {
      if (steps.back() == red)
        moveRed(steps, redCount, blueCount);
      else
        moveBlue(steps, redCount, blueCount);
    }
  }
}
void calcResult(vector<step> steps, int &firstPlayerBalls,
                int &secondPlayerBalls) {
  firstPlayerBalls = secondPlayerBalls = 0;
  for (int i = (1); i <= (int)(steps.size() - 1); i += (1)) {
    if (steps[i - 1] == steps[i])
      firstPlayerBalls++;
    else
      secondPlayerBalls++;
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<step> game1, game2;
  int firstPlayerResult1, secondPlayerResult1;
  int firstPlayerResult2, secondPlayerResult2;
  playGame(game1, true, n, m);
  playGame(game2, false, n, m);
  calcResult(game1, firstPlayerResult1, secondPlayerResult1);
  calcResult(game2, firstPlayerResult2, secondPlayerResult2);
  if (firstPlayerResult1 > firstPlayerResult2)
    cout << firstPlayerResult1 << ' ' << secondPlayerResult1;
  else
    cout << firstPlayerResult2 << ' ' << secondPlayerResult2;
  return 0;
}
