#include <bits/stdc++.h>
using namespace std;
int main() {
  int p, q;
  cin >> p >> q;
  if (p == q)
    cout << (p * 10 + 1) << " " << (q * 10 + 2);
  else if (p == 9 && q == 1)
    cout << 9 << " " << 10;
  else if (q - p == 1)
    cout << (p * 10 + 9) << " " << (q * 10);
  else
    cout << -1;
}
