#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 9, M = 10009, INF = 0x3f3f3f3f, MOD = 100003;
signed main(void) {
  ios::sync_with_stdio(false);
  long long t;
  cin >> t;
  long long n, m;
  while (t--) {
    cin >> n >> m;
    if (n > m) swap(n, m);
    if (n * 2 >= m && (n + m) % 3 == 0)
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
  }
  return 0;
}
