import collections


def main():
    routeList = [list(map(int,input().split())) for _ in range(3)]
    routeList = [i for inner in routeList for i in inner]
    ansList = collections.Counter(routeList)
    
    for i in ansList:
        if ansList[i] == 3:
            print("NO")
            exit()
    print('YES')
    

    


if __name__== "__main__":
    main() 








 import collections collections def main():
    routeList = [list(map(int,input().split())) for _ in range(3)]
    routeList = [i for inner in routeList for i in inner]
    ansList = collections.Counter(routeList)
    
    for i in ansList:
        if ansList[i] == 3:
            print("NO")
            exit()
    print('YES')
    

     main list(map(int,input().split())) for _ in range(3) for _ in range(3) _ range(3) range 3 for _ in range(3) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split routeList = [list(map(int,input().split())) for _ in range(3)] routeList [list(map(int,input().split())) for _ in range(3)] i for inner in routeList for i in inner for inner in routeList for i in inner inner routeList for i in inner i inner for i in inner i routeList = [i for inner in routeList for i in inner] routeList [i for inner in routeList for i in inner] ansList = collections.Counter(routeList) ansList collections.Counter(routeList) collections.Counter collections Counter routeList for i in ansList:
        if ansList[i] == 3:
            print("NO")
            exit()
     i ansList if ansList[i] == 3:
            print("NO")
            exit()
     ansList[i] == 3 ansList[i] ansList i 3 print("NO") print "NO" exit() exit print('YES') print 'YES' if __name__== "__main__":
    main()  __name__== "__main__" __name__ "__main__" main() main def main():
    routeList = [list(map(int,input().split())) for _ in range(3)]
    routeList = [i for inner in routeList for i in inner]
    ansList = collections.Counter(routeList)
    
    for i in ansList:
        if ansList[i] == 3:
            print("NO")
            exit()
    print('YES')
    

     def main():
    routeList = [list(map(int,input().split())) for _ in range(3)]
    routeList = [i for inner in routeList for i in inner]
    ansList = collections.Counter(routeList)
    
    for i in ansList:
        if ansList[i] == 3:
            print("NO")
            exit()
    print('YES')
    

     main
import collections


def main():
    routeList = [list(map(int,input().split())) for _ in range(3)]
    routeList = [i for inner in routeList for i in inner]
    ansList = collections.Counter(routeList)
    
    for i in ansList:
        if ansList[i] == 3:
            print("NO")
            exit()
    print('YES')
    

    


if __name__== "__main__":
    main() 









