#include <iostream>
using namespace std;
int main(void)
{
int t;
cin >> t;
while (t--)
{
int w, temp, sum = 0;
cin >> w;
for (int i = 0; i < 9; i++)
{
cin >> temp;
sum += temp;
}
if (w >= sum) cout << "YES" << endl;
else cout << "NO" << endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKHZvaWQpCnsKCWludCB0OwoJY2luID4+IHQ7CgoJd2hpbGUgKHQtLSkKCXsKCQlpbnQgdywgdGVtcCwgc3VtID0gMDsKCQljaW4gPj4gdzsKCgkJZm9yIChpbnQgaSA9IDA7IGkgPCA5OyBpKyspCgkJewoJCQljaW4gPj4gdGVtcDsKCQkJc3VtICs9IHRlbXA7CgkJfQoJCWlmICh3ID49IHN1bSkgY291dCA8PCAiWUVTIiA8PCBlbmRsOwoJCWVsc2UgY291dCA8PCAiTk8iIDw8IGVuZGw7Cgl9Cn0=