#include <bits/stdc++.h>
using namespace std;
int main() {
  int casos;
  cin >> casos;
  while (casos > 0) {
    int a, b;
    cin >> a >> b;
    if (a > b) {
      int dif = a - b;
      b -= dif;
      a -= dif * 2;
    } else if (b > a) {
      int dif = b - a;
      a -= dif;
      b -= dif * 2;
    }
    if (a % 3 == 0 && a == b && a >= 0) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
    casos--;
  }
}
