a = [int(x) for x in input().split()]
ans = "ДА"
for i in range(1, len(lst)):
if (a[i] > a[i - 1]):
ans = "НЕТ"
print(ans)
a = [int(x) for x in input().split()]
ans = "ДА"
for i in range(1, len(lst)):
if (a[i] > a[i - 1]):
ans = "НЕТ"
print(ans)