Gennady owns a small hotel in the countryside where he lives a peaceful life. He loves to take long walks, watch sunsets and play cards with tourists staying in his hotel. His favorite game is called "Mau-Mau".

To play Mau-Mau, you need a pack of $52$ cards. Each card has a suit (Diamonds — D, Clubs — C, Spades — S, or Hearts — H), and a rank (2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K, or A).

At the start of the game, there is one card on the table and you have five cards in your hand. You can play a card from your hand if and only if it has the same rank or the same suit as the card on the table.

In order to check if you'd be a good playing partner, Gennady has prepared a task for you. Given the card on the table and five cards in your hand, check if you can play at least one card.


-----Input-----

The first line of the input contains one string which describes the card on the table. The second line contains five strings which describe the cards in your hand.

Each string is two characters long. The first character denotes the rank and belongs to the set $\{{\tt 2}, {\tt 3}, {\tt 4}, {\tt 5}, {\tt 6}, {\tt 7}, {\tt 8}, {\tt 9}, {\tt T}, {\tt J}, {\tt Q}, {\tt K}, {\tt A}\}$. The second character denotes the suit and belongs to the set $\{{\tt D}, {\tt C}, {\tt S}, {\tt H}\}$.

All the cards in the input are different.


-----Output-----

If it is possible to play a card from your hand, print one word "YES". Otherwise, print "NO".

You can print each letter in any case (upper or lower).


-----Examples-----
Input
AS
2H 4C TH JH AD

Output
YES

Input
2H
3D 4C AC KD AS

Output
NO

Input
4D
AS AC AD AH 5H

Output
YES



-----Note-----

In the first example, there is an Ace of Spades (AS) on the table. You can play an Ace of Diamonds (AD) because both of them are Aces.

In the second example, you cannot play any card.

In the third example, you can play an Ace of Diamonds (AD) because it has the same suit as a Four of Diamonds (4D), which lies on the table.

Difficulty: interview

Starter code:

Solutions:
c = input()
s = list(input().split())
print('YES' if any(c[0] == x[0] or c[1] == x[1] for x in s) else 'NO')


s = input()
d = input().split()
f = False
for i in d:
    if i[0] == s[0] or i[1] == s[1]:
        f = True
        break
if f:
    print("YES")
else:
    print("NO")

s = input()
arr = input().split()

p = False
for i in arr:
    if (i[0] in s) or (i[1] in s):
        p = True

if p:
    print('YES')
else:
    print('NO')


X = input()
B = list(input().split())

for x in B:
	if x[0] == X[0] or x[1] == X[1]:
		print("YES")
		return

print("NO")


i = input()
i2 = input().split(' ')

out = False

for s in i2:
    if s[0] == i[0] or s[1] == i[1]:
        out = True
        break

if out:
    print('YES')
else:
    print('NO')


s = input()
a = input().split()
for el in a:
	if el[0] == s[0] or el[1] == s[1]:
		print('YES')
		return
print('NO')


s=input()
l1=list(input().split())
flag=0
for item in l1:
    if item[0]==s[0]:
        flag=1
        break
    elif item[1]==s[1]:
        flag=1
        break
if flag==1:
    print("YES")
else :
    print("NO")

import getpass
import sys


def ria():
    return [int(i) for i in input().split()]


if getpass.getuser() != 'frohenk':
    filename = 'half'
    # sys.stdin = open('input.txt')
    # sys.stdout = open('output.txt', 'w')
else:
    sys.stdin = open('input.txt')
    # sys.stdin.close()

crd = input()
cs = input().split()
for i in cs:
    if i[0] == crd[0] or i[1] == crd[1]:
        print('YES')
        return

print('NO')


s = input()
d = input().split()
p = 0
for i in range(5):
    if d[i][0] == s[0] or d[i][1] == s[1]:
        p += 1
if p:
    print("YES")
else:
    print("NO")


x = input()
v = list(input().split())
c = [q[0] for q in v if q[0] == x[0]]
c.extend([q[1] for q in v if q[1] == x[1]])
print("YES" if len(c) > 0 else "NO")


t = input()
a = list(input().split())
can = False
for x in a:
    if x[1] == t[1]:
        can = True
    if x[0] == t[0]:
        can = True
if can:
    print("YES")
else:
    print("NO")

s1 = input()
ls = input().split()
print('YES' if any(any(s1[i] == ls[j][i] for i in range(2)) for j in range(5)) else 'NO')


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import functools
import sys
import math
MAX = sys.maxsize
MAXN = 10**6+10
MOD = 10**9+7
def isprime(n):
    n = abs(int(n))
    if n < 2:
        return False
    if n == 2: 
        return True    
    if not n & 1: 
        return False
    for x in range(3, int(n**0.5) + 1, 2):
        if n % x == 0:
            return False
    return True

def mhd(a,b,x,y):
    return abs(a-x)+abs(b-y)

def numIN():
    return(map(int,sys.stdin.readline().strip().split()))

def charIN():
    return(sys.stdin.readline().strip().split())

t = [0]*1000010

def create(a,n):
	nonlocal t
	for i in range(n,2*n):
		t[i] = a[i-n]
	for i in range(n-1,0,-1):
		t[i] = t[2*i]+t[2*i+1]


def ncr(n,k):
	res = 1
	c = [0]*(k+1)
	c[0]=1
	for i in range(1,n+1):
	    for j in range(min(i,k),0,-1):
	        c[j] = (c[j]+c[j-1])%MOD
	return c[k]

s = input()
r = s[0]
d = s[1]

l = input().split()

for i in l:
	if i[0]==r or i[1]==d:
		print('YES')
		return

print('NO')

A = input()
n = input().split()
print('YES'if any(A.find(k[0])!=-1 or A.find(k[1])!=-1 for k in n)else'NO')


x = input()
deck = list(input().split())

get = False
for d in deck:
	if d[0] == x[0]:
		get = True
	if d[1] == x[1]:
		get = True

if get:
	print("YES")
else:
	print("NO")

c1 = input()
cards = input().split(' ')

for c in cards:
  if c[0] == c1[0] or c[1] == c1[1]:
    print('YES')
    return
print('NO')


# = list(map(int, input().split()))
# = map(int, input().split())
a = input()
z = list(map(str, input().split()))
n = 5
for i in range(n):
    if a[0] == z[i][0] or a[1] == z[i][1]:
        print("YES")
        return
print("NO")


def ok(s1, s2):
    return s1[0] == s2[0] or s1[1] == s2[1]

card = input()
hand = input().split()

flag = False
for c in hand:
    if ok(card, c):
        flag = True

if flag:
    print("YES")
else:
    print("NO")


t = input()
s = [i for i in input().split()]
good = False
for i in s:
    if i[0] == t[0]:
        good = True
    if i[1] == t[1]:
        good = True

if good:
    print('YES')
else:
    print('NO')

import re, math, decimal, bisect
def read(): return input().strip()
def iread(): return int(input().strip())
def viread(): return [int(_) for _ in input().strip().split()]

# code goes here
card = read()
mine = read().split()
for c in mine:
	if c[0] == card[0] or c[1] == card[1]:
		print("YES")
		return

print("NO")


import sys
import math

def read_int():
	return int(input().strip())

def read_int_list():
	return list(map(int,input().strip().split()))

def read_string():
	return input().strip()

def read_string_list(delim=" "):
	return input().strip().split(delim)

###### Author : Samir Vyas #######
###### Write Code Below    #######

table_c = read_string()

cards = read_string_list()

for c in cards:
	if c[0] == table_c[0] or c[1] == table_c[1]:
		print("YES")
		return

print("NO")

s = input()
f = 0
l = input().split()
for i in l:
    if i[0] == s[0] or s[1] == i[1]:
        f = 1
print('YES' if f else 'NO')


a=input()
l=input().split()
yes=0
for i in l:
	if(i[0]==a[0] or i[1]==a[1]):
		yes=1
		break
if(yes):
	print("YES")
else:
	print("NO")

s = input()
a = s[0]
b = s[1]
q = input().split()
ans = "NO"
for el in q:
    if (el[0] == a or el[1] == b):
        ans = "YES"
print(ans)

s = input()
ans='NO'
mass = input().split()
for t in mass:
    for k in t:
        if k==s[0]or k==s[1]:
            ans='YES'
print(ans)