#include <bits/stdc++.h>
using namespace std;
const int INF = ~(1 << 31);
const double EPS = 1e-6;
const double PI = 3.141592653589793;
bool comp1(pair<int, int> a, pair<int, int> b) {
  if (a.second == b.second) {
    return a.first > b.first;
  }
  return a.second < b.second;
}
bool comp2(pair<int, int> a, pair<int, int> b) {
  if (a.second == b.second) {
    return a.first > b.first;
  }
  return a.second > b.second;
}
bool comp3(pair<int, int> a, pair<int, int> b) {
  if (a.second == b.second) {
    return a.first < b.first;
  }
  return a.second > b.second;
}
bool comp4(pair<int, int> a, pair<int, int> b) {
  if (a.second == b.second) {
    return a.first < b.first;
  }
  return a.second < b.second;
}
double angle(pair<int, int> a, pair<int, int> b) {
  return acos((a.first * b.first + a.second * b.second) /
              (sqrt(a.first * a.first + a.second * a.second + 0.0) *
               sqrt(b.first * b.first + b.second * b.second + 0.0))) *
         180 / PI;
}
int triangle_area_2(int x1, int y1, int x2, int y2, int x3, int y3) {
  return (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1);
}
bool clock(int x1, int y1, int x2, int y2, int x3, int y3) {
  return triangle_area_2(x1, y1, x2, y2, x3, y3) > 0;
}
int main() {
  int n, m, x = 0, y = 0;
  cin >> n >> m;
  int nn = n, mm = m;
  n--;
  vector<bool> a(nn + mm, 0);
  for (int i = 0; i < nn + mm - 1; i++) {
    if (!a[i]) {
      if (m) {
        a[i + 1] = 1;
        y++;
        m--;
      } else {
        a[i + 1] = 0;
        n--;
        x++;
      }
    } else {
      if (n) {
        a[i + 1] = 0;
        y++;
        n--;
      } else {
        a[i + 1] = 1;
        m--;
        x++;
      }
    }
    if (i + 1 >= nn + mm - 1) break;
    i++;
    if (!a[i]) {
      if (n) {
        a[i + 1] = 0;
        x++;
        n--;
      } else {
        a[i + 1] = 1;
        m--;
        y++;
      }
    } else {
      if (m) {
        a[i + 1] = 1;
        x++;
        m--;
      } else {
        a[i + 1] = 0;
        n--;
        y++;
      }
    }
  }
  int rx = x, ry = y;
  x = 0;
  y = 0;
  n = nn;
  m = mm;
  m--;
  a[0] = 1;
  for (int i = 0; i < nn + mm - 1; i++) {
    if (!a[i]) {
      if (m) {
        a[i + 1] = 1;
        y++;
        m--;
      } else {
        a[i + 1] = 0;
        n--;
        x++;
      }
    } else {
      if (n) {
        a[i + 1] = 0;
        y++;
        n--;
      } else {
        a[i + 1] = 1;
        m--;
        x++;
      }
    }
    if (i + 1 >= nn + mm - 1) break;
    i++;
    if (!a[i]) {
      if (n) {
        a[i + 1] = 0;
        x++;
        n--;
      } else {
        a[i + 1] = 1;
        m--;
        y++;
      }
    } else {
      if (m) {
        a[i + 1] = 1;
        x++;
        m--;
      } else {
        a[i + 1] = 0;
        n--;
        y++;
      }
    }
  }
  if (x > rx || (x == rx && y < ry)) {
    cout << x << ' ' << y << endl;
  } else {
    cout << rx << ' ' << ry << endl;
  }
  return 0;
}
