#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
long long lcm(long long a, long long b) { return (a * b) / (gcd(a, b)); }
void solve() {
  long long n, m;
  cin >> n >> m;
  string str1 = "", str2 = "";
  char MX = 'N', MN = 'M';
  for (long long i = 0; i < max(n / 2 + 1, m / 2 + 1); i++) {
    str1 += MX;
    str1 += MN;
    str1 += MN;
    str1 += MX;
  }
  for (long long i = 0; i < max(n / 2 + 1, m / 2 + 1); i++) {
    str2 += MN;
    str2 += MX;
    str2 += MX;
    str2 += MN;
  }
  string ans1 = "", ans2 = "";
  long long temp1 = n, temp2 = m;
  for (auto itr : str1) {
    if (temp1 == 0) {
      if (temp2 > 0) {
        for (long long i = 0; i < temp2; i++) {
          ans1 += 'M';
        }
        break;
      } else {
        break;
      }
    }
    if (temp2 == 0) {
      if (temp1 > 0) {
        for (long long i = 0; i < temp1; i++) {
          ans1 += 'N';
        }
        break;
      } else {
        break;
      }
    } else if (itr == 'N') {
      ans1 += 'N';
      temp1--;
    } else if (itr == 'M') {
      ans1 += 'M';
      temp2--;
    }
  }
  temp1 = n, temp2 = m;
  for (auto itr : str2) {
    if (temp1 == 0) {
      if (temp2 > 0) {
        for (long long i = 0; i < temp2; i++) {
          ans2 += 'M';
        }
        break;
      } else {
        break;
      }
    }
    if (temp2 == 0) {
      if (temp1 > 0) {
        for (long long i = 0; i < temp1; i++) {
          ans2 += 'N';
        }
        break;
      } else {
        break;
      }
    } else if (itr == 'N') {
      ans2 += 'N';
      temp1--;
    } else if (itr == 'M') {
      ans2 += 'M';
      temp2--;
    }
  }
  long long ANS1 = 0, ANS2 = 0;
  for (long long i = 0; i < ans1.size(); i++) {
    if (ans1[i] == ans1[i + 1]) {
      ANS1++;
    }
  }
  for (long long i = 0; i < ans2.size(); i++) {
    if (ans2[i] == ans2[i + 1]) {
      ANS2++;
    }
  }
  if (ANS1 >= ANS2) {
    cout << ANS1 << " " << n + m - ANS1 - 1 << "\n";
  } else {
    cout << ANS2 << " " << n + m - ANS2 - 1 << "\n";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
}
