#include <bits/stdc++.h>
using namespace std;
long long a, b;
void solve() {
  cin >> a >> b;
  if (a > 9 || b > 9) {
    cout << -1 << "\n";
    return;
  };
  {
    cout << a * b << "\n";
    return;
  };
}
void prep() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  prep();
  cout << fixed << setprecision(12);
  while (t--) solve();
  return 0;
}
