文件目录

#include <iostream>
using namespace std;
int main()
{
    int n, a;
    cin >> n;
    while (n--)
    {
        cin >> a;
        int sum = 0;
        while (a)
        {
            sum += a % 10;
            a /= 10;
        }
        if (sum % 7 == 0)
            cout << "Yes\n";
        else
            cout << "No\n";
    }
    return 0;
}