#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b, d, c;
    cin >> a >> b;
    int mx = max(a, b);
    int mn = min(a, b);
    if ((a == 1 && b == 1) || (mx > 2 * mn) || (a == 2 && b == 2)) {
      cout << "NO" << endl;
    } else if ((a + b) == 3 || (a + b) == 6) {
      cout << "YES" << endl;
    } else {
      d = a / 3;
      d = d * 3;
      d = a - d;
      c = b / 3;
      c = c * 3;
      c = b - c;
      if ((c == 0 && d == 0) || (c == 1 && d == 2) || (c == 2 && d == 1))
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
