import java.io.PrintWriter ;
import java.util.Scanner ;
public class SagheerAndCrossroads_MainSolution {
public static void main
( String [ ] args
) {
Scanner sc
= new Scanner
( System .
in ) ;
int [ ] [ ] part = new int [ 4 ] [ 4 ] ;
for ( int i = 0 ; i < 4 ; ++ i)
for ( int j = 0 ; j < 4 ; ++ j)
part[ i] [ j] = sc.nextInt ( ) ;
int [ ] crossed = new int [ 4 ] ;
for ( int i = 0 ; i < 4 ; ++ i)
for ( int j = 1 ; j <= 3 ; ++ j)
{
crossed[ i] |= part[ i] [ 3 - j] ;
crossed[ ( i + j) % 4 ] |= part[ i] [ 3 - j] ;
}
boolean accident = false ;
for ( int i = 0 ; i < 4 ; ++ i)
accident |= crossed[ i] + part[ i] [ 3 ] == 2 ;
out.println ( accident ? "YES" : "NO" ) ;
sc.close ( ) ;
out.close ( ) ;
}
}
aW1wb3J0IGphdmEuaW8uUHJpbnRXcml0ZXI7CmltcG9ydCBqYXZhLnV0aWwuU2Nhbm5lcjsKCnB1YmxpYyBjbGFzcyBTYWdoZWVyQW5kQ3Jvc3Nyb2Fkc19NYWluU29sdXRpb24gewoKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsKCQkKCQlTY2FubmVyIHNjID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlQcmludFdyaXRlciBvdXQgPSBuZXcgUHJpbnRXcml0ZXIoU3lzdGVtLm91dCk7CgkJCgkJaW50W11bXSBwYXJ0ID0gbmV3IGludFs0XVs0XTsKCQlmb3IoaW50IGkgPSAwOyBpIDwgNDsgKytpKQoJCQlmb3IoaW50IGogPSAwOyBqIDwgNDsgKytqKQoJCQkJcGFydFtpXVtqXSA9IHNjLm5leHRJbnQoKTsKCQlpbnRbXSBjcm9zc2VkID0gbmV3IGludFs0XTsKCQlmb3IoaW50IGkgPSAwOyBpIDwgNDsgKytpKQoJCQlmb3IoaW50IGogPSAxOyBqIDw9IDM7ICsraikKCQkgICAgewoJCS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