#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b, c;
    cin >> a;
    cin >> b;
    if (a > 9) {
      cout << -1 << endl;
    } else if (b > 9) {
      cout << -1 << endl;
    } else {
      c = a * b;
      cout << c << endl;
    }
  }
  return 0;
}
