#include <bits/stdc++.h>
using namespace std;
const double dancila = 3.14159265359;
int main() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    int prod = n * m;
    int k = 1;
    while (k * 2 < prod) k++;
    cout << k << "\n";
  }
}
