#include <bits/stdc++.h>
const int Z = (int)1e5 + 123;
const int inf = (int)2e9 + 123;
const long long llinf = (long long)2e18 + 123;
const double PI = acos(-1.0);
using namespace std;
bool check(bool& flag, long long& a, long long& b) {
  if (a == 1 && b == 1) {
    flag = false;
    return true;
  }
  if (a == 0 && b != 0) {
    flag = false;
    return true;
  }
  if (a != 0 && b == 0) {
    flag = false;
    return true;
  }
  if (a < 0 || b < 0) {
    flag = false;
    return true;
  }
  if (a == 1 && b == 2) {
    return true;
  }
  if (a == 2 && b == 1) {
    return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ;
  int t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    bool flag = true;
    while (true) {
      if (check(flag, a, b)) break;
      if (a < b) swap(a, b);
      long long dif = a - b;
      a -= dif * 2;
      b -= dif;
      if (dif == 0) {
        if (a % 3 == 0) {
          break;
        }
        flag = false;
        break;
      }
      if (check(flag, a, b)) break;
    }
    cout << (flag ? "YES \n" : "NO \n");
  };
  return 0;
}
