#include<stdio.h>
#include<stdbool.h>
bool use(int u[3][3], int a, int b, int c){
if(a < 0|| b < 0|| c < 0) return false;
if(a + b + c == 0) return true;
return use(u, a - u[0][0], b - u[0][1], c - u[0][2])|use(u, a - u[1][0], b - u[1][1], c - u[1][2])|use(u, a - u[2][0], b - u[2][1], c - u[2][2]);
return false;
}
void check(int u[3][3], int n){
if(n<=0) return;
int a, b, c;
scanf("%d %d %d", &a
, &b
, &c
); if(use
(u
, a
, b
, c
)) printf("yes\n"); check(u, n-1);
}
int main(){
int u[3][3];
scanf("%d %d %d %d %d %d %d %d %d", &u
[0][0], &u
[0][1], &u
[0][2], &u
[1][0], &u
[1][1], &u
[1][2], &u
[2][0], &u
[2][1], &u
[2][2]); int n;
check(u, n);
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8c3RkYm9vbC5oPgpib29sIHVzZShpbnQgdVszXVszXSwgaW50IGEsIGludCBiLCBpbnQgYyl7CiAgICBpZihhIDwgMHx8IGIgPCAwfHwgYyA8IDApIHJldHVybiAgZmFsc2U7CiAgICBpZihhICsgYiArIGMgPT0gMCkgcmV0dXJuIHRydWU7CiAgICByZXR1cm4gdXNlKHUsIGEgLSB1WzBdWzBdLCBiIC0gdVswXVsxXSwgYyAtIHVbMF1bMl0pfHVzZSh1LCBhIC0gdVsxXVswXSwgYiAtIHVbMV1bMV0sIGMgLSB1WzFdWzJdKXx1c2UodSwgYSAtIHVbMl1bMF0sIGIgLSB1WzJdWzFdLCBjIC0gdVsyXVsyXSk7CiAgICByZXR1cm4gZmFsc2U7Cn0KCnZvaWQgY2hlY2soaW50IHVbM11bM10sIGludCBuKXsKICAgIGlmKG48PTApIHJldHVybjsKICAgIGludCBhLCBiLCBjOwogICAgc2NhbmYoIiVkICVkICVkIiwgJmEsICZiLCAmYyk7CiAgICBpZih1c2UodSwgYSwgYiwgYykpIHByaW50ZigieWVzXG4iKTsKICAgIGVsc2UgcHJpbnRmKCJub1xuIik7CiAgICBjaGVjayh1LCBuLTEpOwp9CgppbnQgbWFpbigpewogICAgaW50IHVbM11bM107CiAgICBzY2FuZigiJWQgJWQgJWQgJWQgJWQgJWQgJWQgJWQgJWQiLCAmdVswXVswXSwgICZ1WzBdWzFdLCAmdVswXVsyXSwgJnVbMV1bMF0sICAmdVsxXVsxXSwgJnVbMV1bMl0sICZ1WzJdWzBdLCAgJnVbMl1bMV0sICZ1WzJdWzJdKTsKICAgIGludCBuOwogICAgc2NhbmYoIiVkIiwgJm4pOwogICAgY2hlY2sodSwgbik7Cn0=