#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    int a, b;
    cin >> a >> b;
    if (a < b) swap(a, b);
    int x = a - b;
    if (x > b) {
      cout << "NO\n";
    } else if (x == b) {
      cout << "YES\n";
    } else if (x < b) {
      if ((b - x) % 3 == 0)
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
}
