#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c = 2;
  cin >> n >> m;
  if (n > m) swap(n, m);
  int N = n, M = m;
  vector<int> a;
  a.push_back(0);
  n--;
  while (n || m) {
    if (c % 2 == 1) {
      int size = a.size();
      if (a[size - 1] == 0) {
        if (n > 0) {
          a.push_back(0);
          n--;
        } else {
          a.push_back(1);
          m--;
        }
      } else {
        if (m > 0) {
          a.push_back(1);
          m--;
        } else {
          a.push_back(0);
          n--;
        }
      }
    } else {
      int size = a.size();
      if (a[size - 1] == 0) {
        if (m > 0) {
          a.push_back(1);
          m--;
        } else {
          a.push_back(0);
          n--;
        }
      } else {
        if (n > 0) {
          a.push_back(0);
          n--;
        } else {
          a.push_back(1);
          m--;
        }
      }
    }
    c++;
  }
  int i;
  int c1 = 0, c2 = 0;
  for (i = 0; i + 1 < a.size(); i++)
    if (a[i] == a[i + 1]) c1++;
  for (i = 0; i + 1 < a.size(); i++)
    if (a[i] != a[i + 1]) c2++;
  int ans1 = c1, ans2 = c2;
  {
    vector<int> a;
    a.push_back(1);
    n = N;
    m = M;
    m--;
    int c = 2;
    while (n || m) {
      if (c % 2 == 1) {
        int size = a.size();
        if (a[size - 1] == 0) {
          if (n > 0) {
            a.push_back(0);
            n--;
          } else {
            a.push_back(1);
            m--;
          }
        } else {
          if (m > 0) {
            a.push_back(1);
            m--;
          } else {
            a.push_back(0);
            n--;
          }
        }
      } else {
        int size = a.size();
        if (a[size - 1] == 0) {
          if (m > 0) {
            a.push_back(1);
            m--;
          } else {
            a.push_back(0);
            n--;
          }
        } else {
          if (n > 0) {
            a.push_back(0);
            n--;
          } else {
            a.push_back(1);
            m--;
          }
        }
      }
      c++;
    }
    int c1 = 0, c2 = 0;
    for (i = 0; i + 1 < a.size(); i++)
      if (a[i] == a[i + 1]) c1++;
    for (i = 0; i + 1 < a.size(); i++)
      if (a[i] != a[i + 1]) c2++;
    if (c1 >= ans1) {
      ans1 = c1;
      if (ans1 == c1)
        ans2 = min(ans2, c2);
      else
        ans2 = c2;
    }
  }
  cout << ans1 << " " << ans2 << endl;
  return 0;
}
