#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    int a, b;
    scanf("%d %d", &a, &b);
    if ((a + b) % 3 != 0) {
      printf("NO\n");
      continue;
    } else {
      int minn, maxn;
      if (a > b) {
        minn = b;
        maxn = a;
      } else if (a < b) {
        minn = a;
        maxn = b;
      } else if (a == b) {
        printf("YES\n");
        continue;
      }
      if (maxn - minn > minn) {
        printf("NO\n");
        continue;
      } else {
        printf("YES\n");
        continue;
      }
    }
  }
  return 0;
}
