#include <bits/stdc++.h>
void solve(int a, int b) {
  if (a != b && abs(a - b) == 8) {
    if (a > b) {
      std::cout << a << '9' << " " << b << '0' << '0';
    } else {
      std::cout << -1 << std::endl;
    }
  } else if (abs(a - b) == 0) {
    std::cout << a << '1' << " " << b << '2' << std::endl;
  } else if (abs(a - b) == 1) {
    if (a > b) {
      std::cout << -1 << std::endl;
    } else {
      std::cout << a << '9' << " " << b << '0' << std::endl;
    }
  } else {
    std::cout << -1 << std::endl;
  }
}
int main() {
  int a, b;
  std::cin >> a >> b;
  solve(a, b);
  return 0;
}
