import typing import sys # import re import math import collections # import decimal import bisect import itertools import fractions # import functools import copy import heapq import decimal # import statistics import queue # import numpy as np # sys.setrecursionlimit(10000001) INF = 10 ** 20 MOD = 10 ** 9 + 7 # MOD = 998244353 def ni(): return int(sys.stdin.buffer.readline()) def ns(): return map(int, sys.stdin.buffer.readline().split()) def na(): return list(map(int, sys.stdin.buffer.readline().split())) # ===CODE=== def main(): l1 = na() l2 = na() flg1 = l1 == l2 l1.sort() l2.sort() flg2 = l1 == l2 flg3 = len(set(l1)) == 3 if flg2: print("Yes") if flg1 and flg3: print(2) print(2) else: print(2) exit(0) print("No") if __name__ == '__main__': main()