/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (Windows, macOS, Linux)
 * Author: sq5rix
 * Time: 2020-12-17 15:35:24
**/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

string solve(){
   long long a,b,c,m,s;
   cin>>a>>b>>c;
    m = min(min(a,b),c);
    s = a+b+c;

    if((s<=9*m)&&(s%9==0)) return "YES" ;
    return "NO";
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int tc;
    cin >> tc;
    for (int t = 1; t <= tc; t++) {
        cout << solve()<< endl;
    }
    return 0;
}
