#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t != 0) {
    int a, b, x, y;
    cin >> a >> b;
    if (a > b) {
      x = a, y = b;
    } else {
      x = b;
      y = a;
    }
    int z = x - y;
    if (z > y) {
      cout << "NO" << endl;
    } else {
      x = x - 2 * z;
      y = y - z;
      if (x % 3 == 0 && y % 3 == 0) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }
    }
    t--;
  }
  return 0;
}
