#include <bits/stdc++.h>
using namespace std;
const int64_t mod = 1e9 + 7;
const int64_t MAX_I = 9223372036854775807;
const int64_t MIN_I = -9223372036854775807;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int64_t t;
  cin >> t;
  while (t--) {
    int64_t A, B;
    cin >> A >> B;
    if (A < 10 && A > 0 && B < 10 && B > 0)
      cout << A * B << "\n";
    else
      cout << "-1\n";
  }
}
