#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    if (a < b) {
      if ((a + b) % 3 == 0 and b <= a * 2) {
        cout << "YES\n";
      } else {
        cout << "NO\n";
      }
    } else {
      if ((a + b) % 3 == 0 and a <= b * 2) {
        cout << "YES\n";
      } else {
        cout << "NO\n";
      }
    }
  }
  return 0;
}
