#include <bits/stdc++.h>
using namespace std;
int a, b, c, d;
void Process1(int n, int m, char ch) {
  int i = 1, j, k;
  while (n or m) {
    if (i == 1) {
      i = 0;
      if (ch == 'r' and m > 0) {
        ch = 'b';
        m--;
        b++;
      } else if (ch == 'b' and n > 0) {
        ch = 'r';
        n--;
        b++;
      } else if (ch == 'r' and n > 0) {
        n--;
        a++;
      } else if (ch == 'b' and m > 0) {
        m--;
        a++;
      }
    } else {
      i = 1;
      if (ch == 'r' and n > 0) {
        ch = 'r';
        n--;
        a++;
      } else if (ch == 'b' and m > 0) {
        ch = 'b';
        m--;
        a++;
      } else if (ch == 'r' and m > 0) {
        m--;
        b++;
      } else if (ch == 'b' and n > 0) {
        n--;
        b++;
      }
    }
  }
}
void Process2(int n, int m, char ch) {
  int i = 1, j, k;
  while (n or m) {
    if (i == 1) {
      i = 0;
      if (ch == 'r' and m > 0) {
        ch = 'b';
        m--;
        d++;
      } else if (ch == 'b' and n > 0) {
        ch = 'r';
        n--;
        d++;
      } else if (ch == 'r' and n > 0) {
        n--;
        c++;
      } else if (ch == 'b' and m > 0) {
        m--;
        c++;
      }
    } else {
      i = 1;
      if (ch == 'r' and n > 0) {
        ch = 'r';
        n--;
        c++;
      } else if (ch == 'b' and m > 0) {
        ch = 'b';
        m--;
        c++;
      } else if (ch == 'r' and m > 0) {
        m--;
        d++;
      } else if (ch == 'b' and n > 0) {
        n--;
        d++;
      }
    }
  }
}
int main() {
  int n, m;
  while (cin >> n >> m) {
    a = b = c = d = 0;
    Process1(n - 1, m, 'r');
    Process2(n, m - 1, 'b');
    if (a > c)
      cout << a << " " << b << endl;
    else
      cout << c << " " << d << endl;
  }
  return 0;
}
