Every summer Vitya comes to visit his grandmother in the countryside. This summer, he got a huge wart. Every grandma knows that one should treat warts when the moon goes down. Thus, Vitya has to catch the moment when the moon is down.

Moon cycle lasts 30 days. The size of the visible part of the moon (in Vitya's units) for each day is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, and then cycle repeats, thus after the second 1 again goes 0.

As there is no internet in the countryside, Vitya has been watching the moon for n consecutive days and for each of these days he wrote down the size of the visible part of the moon. Help him find out whether the moon will be up or down next day, or this cannot be determined by the data he has.


-----Input-----

The first line of the input contains a single integer n (1 ≤ n ≤ 92) — the number of consecutive days Vitya was watching the size of the visible part of the moon. 

The second line contains n integers a_{i} (0 ≤ a_{i} ≤ 15) — Vitya's records.

It's guaranteed that the input data is consistent.


-----Output-----

If Vitya can be sure that the size of visible part of the moon on day n + 1 will be less than the size of the visible part on day n, then print "DOWN" at the only line of the output. If he might be sure that the size of the visible part will increase, then print "UP". If it's impossible to determine what exactly will happen with the moon, print -1.


-----Examples-----
Input
5
3 4 5 6 7

Output
UP

Input
7
12 13 14 15 14 13 12

Output
DOWN

Input
1
8

Output
-1



-----Note-----

In the first sample, the size of the moon on the next day will be equal to 8, thus the answer is "UP".

In the second sample, the size of the moon on the next day will be 11, thus the answer is "DOWN".

In the third sample, there is no way to determine whether the size of the moon on the next day will be 7 or 9, thus the answer is -1.

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
n = int(input())
s = list(map(int, input().split()))[:n]
k = -1
if s[n - 1] == 0:
	print('UP')
elif s[n - 1] == 15 or s[n - 2] > s[n - 1]:
	print('DOWN')
elif n == 1:
	print(k)
else:
	print('UP')


n = int(input())
list = [int(i) for i in input().split()]
if n == 1 and list[0] == 0:
	print('UP')
	exit()
elif n == 1 and list[0] == 15:
	print('DOWN')
	exit()
elif n == 1:
	print('-1')
	exit()
(a, b) = (list[n - 2], list[n - 1])
if b == a + 1 and a >= 0 and (a <= 13) or (a == 1 and b == 0):
	print('UP')
elif a >= 2 and a <= 15 and (a == b + 1) or (a == 14 and b == 15):
	print('DOWN')
else:
	print('-1')


n = int(input())
a = [int(x) for x in input().split()]
up = True
if a[-1] == 15:
	print('DOWN')
elif a[-1] == 0:
	print('UP')
elif len(a) == 1:
	print(-1)
elif a[-1] - 1 == a[-2]:
	print('UP')
else:
	print('DOWN')


n = int(input())
vis = list(map(int, input().split()))
res = ''
if vis[-1] == 0:
	print('UP')
elif vis[-1] == 15:
	print('DOWN')
elif len(vis) == 1:
	print(-1)
elif vis[-1] > vis[-2]:
	print('UP')
else:
	print('DOWN')


n = int(input())
a = list(map(int, input().split()))
if n == 1:
	if a[0] == 0:
		print('UP')
	elif a[0] == 15:
		print('DOWN')
	else:
		print(-1)
else:
	x = a[n - 2]
	y = a[n - 1]
	if y == 0:
		print('UP')
	elif y == 15:
		print('DOWN')
	elif x > y:
		print('DOWN')
	else:
		print('UP')


n = int(input())
l = list(map(int, input().split()))
inc = dec = 0
for x in range(n - 1):
	if l[x] < l[x + 1]:
		inc = 1
		dec = 0
	else:
		inc = 0
		dec = 1
if inc and l[-1] == 15:
	print('DOWN')
elif inc:
	print('UP')
elif dec and l[-1] == 0:
	print('UP')
elif dec:
	print('DOWN')
elif l[-1] == 15:
	print('DOWN')
elif l[-1] == 0:
	print('UP')
else:
	print(-1)


n = int(input())
a = list(map(int, input().split()))
if n == 1 and a[-1] == 0:
	print('UP')
elif n == 1 and a[-1] != 15:
	print(-1)
elif a[-1] == 15:
	print('DOWN')
elif a[-2] - a[-1] == 1 and a[-1] == 0:
	print('UP')
elif a[-2] - a[-1] == 1 and a[-1] == 15:
	print('DOWN')
elif a[-2] - a[-1] == 1:
	print('DOWN')
elif a[-2] - a[-1] == -1 and a[-1] == 15:
	print('DOWN')
elif a[-2] - a[-1] == -1:
	print('UP')


n = int(input())
xs = list(map(int, input().split()))
if xs[-1] == 15:
	print('DOWN')
elif n == 1:
	if xs[0] == 0:
		print('UP')
	else:
		print('-1')
elif xs[-2] < xs[-1]:
	print('UP')
elif xs[-1] == 0:
	print('UP')
else:
	print('DOWN')


def countryside():
	n = int(input())
	s = list(map(int, input().split()))
	if n == 1:
		if s[0] == 15:
			print('DOWN')
		elif s[0] == 0:
			print('UP')
		else:
			print(-1)
	elif s[-1] > s[-2]:
		if s[-1] != 15:
			print('UP')
		else:
			print('DOWN')
	elif s[-1] != 0:
		print('DOWN')
	else:
		print('UP')
countryside()


n = int(input())
line = list(map(int, input().split()))
if n == 1 and line[0] != 0 and (line[0] != 15):
	print(-1)
elif n == 1 and line[0] == 0:
	print('UP')
elif n == 1:
	print('DOWN')
elif line[-1] > line[-2] and line[-1] == 15:
	print('DOWN')
elif line[-1] > line[-2]:
	print('UP')
elif line[-1] == 0:
	print('UP')
else:
	print('DOWN')


n = int(input())
lst = [int(i) for i in input().split()]
if n == 1:
	if lst[0] == 0:
		print('UP')
	else:
		print(-1 if lst[0] != 15 else 'DOWN')
elif lst[-1] > lst[-2] and lst[-1] != 15 or lst[-1] == 0:
	print('UP')
else:
	print('DOWN')


n = int(input())
var = [int(x) for x in input().split()]
if len(var) <= 1:
	if var[n - 1] == 15:
		print('DOWN')
	elif var[n - 1] == 0:
		print('UP')
	else:
		print('-1')
elif var[n - 1] > var[n - 2]:
	if var[n - 1] == 15:
		print('DOWN')
	else:
		print('UP')
elif var[n - 1] < var[n - 2]:
	if var[n - 1] == 0:
		print('UP')
	else:
		print('DOWN')


import sys
Input = sys.stdin.readline
N = int(Input())
x = list(map(int, Input().split()))
if x[-1] == 15:
	exit(print('DOWN'))
if x[-1] == 0:
	exit(print('UP'))
if N is 1:
	exit(print(-1))
print('UP' if x[-2] < x[-1] else 'DOWN')


n = int(input())
l = list(map(int, input().rstrip().split(' ')))
if n == 1:
	if l[0] == 0:
		print('UP')
	elif l[0] == 15:
		print('DOWN')
	else:
		print(-1)
elif l[-1] == 15:
	print('DOWN')
elif l[-1] == 0:
	print('UP')
elif l[-1] - l[-2] < 0:
	print('DOWN')
else:
	print('UP')


ObservedDays = int(input())
MoonSizes = [int(x) for x in input().split()]
if len(MoonSizes) == 1:
	if MoonSizes[0] == 15:
		print('DOWN')
	elif MoonSizes[0] == 0:
		print('UP')
	else:
		print(-1)
elif MoonSizes[-1] == 15:
	print('DOWN')
elif MoonSizes[-1] == 0:
	print('UP')
elif MoonSizes[-1] > MoonSizes[-2]:
	print('UP')
else:
	print('DOWN')


from math import *
import sys
n = int(input())
a = list(map(int, input().split()))
if a[-1] == 0:
	print('UP')
elif a[-1] == 15:
	print('DOWN')
elif n == 1:
	print(-1)
elif n == 2:
	if a[1] == 0:
		print('UP')
	elif a[1] == 15:
		print('DOWN')
	elif a[1] > a[0]:
		print('UP')
	else:
		print('DOWN')
elif a[-1] > a[-3]:
	print('UP')
elif a[-1] < a[-3]:
	print('DOWN')
elif a[-1] == 1:
	print('UP')
else:
	print('DOWN')


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
nb_days = int(input())
days = read_ints()
last = days[-1]
if last == 15:
	print('DOWN')
elif last == 0:
	print('UP')
elif nb_days == 1:
	print(-1)
elif last > days[-2]:
	print('UP')
else:
	print('DOWN')


def vitya(n, array):
	if array[n - 1] == 15:
		return 'DOWN'
	elif array[n - 1] == 0:
		return 'UP'
	elif n == 1:
		return -1
	elif array[n - 1] > array[n - 2]:
		return 'UP'
	else:
		return 'DOWN'
t = int(input())
array = list(map(int, input().split(' ')))
print(vitya(t, array))


def main():
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		if a[0] == 15:
			print('DOWN')
		elif a[0] == 0:
			print('UP')
		else:
			print(-1)
		return
	if a[-2] < a[-1]:
		if a[-1] != 15:
			print('UP')
		else:
			print('DOWN')
	elif a[-1] != 0:
		print('DOWN')
	else:
		print('UP')
main()


d = input()
day = list(map(int, input().split()))
days = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
if day[-1] == 0:
	print('UP')
elif day[-1] == 15:
	print('DOWN')
elif len(day) == 1:
	print(-1)
else:
	r = day[-1] - day[-2]
	if r == 1:
		print('UP')
	elif r == -1:
		print('DOWN')


import sys
n = int(input())
d = []
d += [int(x) for x in input().split()]
if n < 2 and d[n - 1] != 0 and (d[n - 1] != 15):
	print('-1')
else:
	if d[n - 1] == 0:
		print('UP')
		sys.exit()
	if d[n - 1] == 15:
		print('DOWN')
		sys.exit()
	if d[n - 1] < d[n - 2]:
		print('DOWN')
	else:
		print('UP')


n = int(input())
A = tuple(map(int, input().split()))
if 1 > A[-1]:
	print('UP')
elif 14 < A[-1]:
	print('DOWN')
elif 2 > n:
	print(-1)
else:
	print('DOWN' if A[-1] < A[-2] else 'UP')


I = lambda : map(int, input().split())
n = int(input())
a = [int(x) for x in input().split()]
if n == 1:
	if a[0] == 15:
		print('DOWN')
	elif a[0] == 0:
		print('UP')
	else:
		print(-1)
elif a[n - 1] == 0 and a[n - 2] == 1:
	print('UP')
elif a[n - 1] == 15 and a[n - 2] == 14:
	print('DOWN')
elif a[n - 1] > a[n - 2]:
	print('UP')
else:
	print('DOWN')


x = int(input())
l = list(map(int, input().split()))
l2 = [15, 0]
if len(l) == 1:
	if l[0] != 0 and l[0] != 15:
		print(-1)
	elif l[0] == 0:
		print('UP')
	else:
		print('DOWN')
elif l[-1] == 15:
	print('DOWN')
elif l[-1] == 0:
	print('UP')
elif l[-2] > l[-1]:
	print('DOWN')
else:
	print('UP')


x = int(input())
y = list(map(int, input().split()))
z = len(y) - 1
if y[z] == 0:
	out = 'UP'
elif y[z] == 15:
	out = 'DOWN'
elif x == 1:
	out = -1
elif y[z] < y[z - 1]:
	out = 'DOWN'
else:
	out = 'UP'
print(out)


N = int(input())
X = list((int(I) for I in input().split(' ')))
if X[-1] == 15:
	print('DOWN')
	exit(0)
elif X[-1] == 0:
	print('UP')
	exit(0)
elif len(X) == 1:
	print(-1)
	exit(0)
else:
	W = X[-1] - X[-2]
	if W == 1:
		print('UP')
		exit(0)
	else:
		print('DOWN')
		exit(0)


n = int(input())
arr = [int(a) for a in input().split()]
if arr[n - 1] == 15:
	print('DOWN')
	exit()
if arr[n - 1] == 0:
	print('UP')
	exit()
if n == 1:
	print('-1')
	exit()
if arr[n - 1] > arr[n - 2]:
	print('UP')
	exit()
print('DOWN')


n = int(input())
a = list(map(int, input().split()))
if a[n - 1] == 0:
	print('UP')
	exit(0)
if a[n - 1] == 15:
	print('DOWN')
	exit(0)
if n == 1:
	print('-1')
	exit(0)
d = a[n - 1] - a[n - 2]
if d < 0:
	print('DOWN')
else:
	print('UP')


n = int(input())
moon = list(map(int, input().split()))
if moon[n - 1] == 15:
	print('DOWN')
elif moon[n - 1] == 0:
	print('UP')
elif n == 1:
	print(-1)
elif moon[n - 1] > moon[n - 2]:
	print('UP')
elif moon[n - 1] < moon[n - 2]:
	print('DOWN')


seq = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
m = int(input())
n = list(map(int, input().split()))
first_element = n[0]
if len(n) == 1 and n[0] not in [0, 15]:
	print(-1)
else:
	for j in range(len(seq)):
		if seq[j] == first_element:
			for k in range(m):
				if seq[j + k] != n[k]:
					break
				elif k == m - 1:
					print('UP' if seq[j + m] > seq[j + k] else 'DOWN')
					exit()


Y = lambda : list(map(int, input().split()))
N = lambda : int(input())
n = N()
a = Y()
(k, ans) = (-1, -1)
for i in range(n, 0, -1):
	if a[i - 1] == 0:
		ans = 1
		break
	if a[i - 1] == 15:
		ans = 0
		break
	if k >= 0:
		ans = not a[i - 1] > k
		break
	else:
		k = a[i - 1]
print(['DOWN', 'UP', -1][ans if ans != -1 else 2])


n = int(input())
a = list(map(int, input().strip().split()))
if len(a) == 1 and a[0] != 15 and (a[0] != 0):
	print('-1')
if a[n - 1] > a[n - 2] and a[n - 1] <= 14:
	print('UP')
if a[n - 1] < a[n - 2] and a[n - 1] >= 1:
	print('DOWN')
if a[n - 1] == 15:
	print('DOWN')
if a[n - 1] == 0:
	print('UP')


n = int(input())
a = list(map(int, input().split()))
set_up = True
if a[n - 1] == 0:
	print('UP')
	exit()
if len(a) == 1 and a[0] == 15:
	print('DOWN')
	exit()
if len(a) == 1:
	print(-1)
	exit()
for i in range(1, len(a)):
	if a[i] > a[i - 1]:
		set_up = True
	else:
		set_up = False
if a[n - 1] == 15:
	set_up = False
if set_up:
	print('UP')
else:
	print('DOWN')


n = int(input())
lst = list(map(int, input().split()))
if n == 1:
	if lst[0] == 0:
		print('UP')
	elif lst[0] == 15:
		print('DOWN')
	else:
		print(-1)
elif lst[n - 1] == 0:
	print('UP')
else:
	lsta = sorted(lst)
	if lst == lsta:
		if lst[n - 1] != 15:
			print('UP')
		else:
			print('DOWN')
	elif lsta == lst[::-1]:
		if lst[n - 1] != 0:
			print('DOWN')
		else:
			print('UP')
	elif lst[n - 1] != 15:
		if lst[n - 1] > lst[n - 2]:
			print('UP')
		else:
			print('DOWN')
	elif lst[n - 1] == 15:
		print('DOWN')


import sys
n = int(input())
arr = [int(a) for a in input().strip().split(' ')]
b = arr[-1]
if b == 0:
	print('UP')
elif b == 15:
	print('DOWN')
elif n == 1:
	print('-1')
else:
	c = arr[-2]
	if b < c:
		print('DOWN')
	else:
		print('UP')


import sys
n = int(input())
a = list(map(int, sys.stdin.readline().split()))
if a[-1] == 0:
	print('UP')
elif a[-1] == 15:
	print('DOWN')
elif len(a) == 1:
	print(-1)
elif a[-1] > a[-2]:
	print('UP')
else:
	print('DOWN')


import sys
n = int(input())
s = [int(x) for x in input().split()]
if s[len(s) - 1] == 15:
	print('DOWN')
	sys.exit()
if s[len(s) - 1] == 0:
	print('UP')
	sys.exit()
if len(s) == 1:
	print(-1)
	sys.exit()
if s[len(s) - 1] > s[len(s) - 2]:
	print('UP')
if s[len(s) - 1] < s[len(s) - 2]:
	print('DOWN')


N = input()
A = list(map(int, input().split()))
if A[-1] == 0:
	print('UP')
elif A[-1] == 15:
	print('DOWN')
elif len(A) == 1:
	print(-1)
elif A[-2] < A[-1]:
	print('UP')
else:
	print('DOWN')


input()
a = list(map(int, input().split()))
if len(a) == 1 and a[0] != 15 and (a[0] != 0):
	print('-1')
elif a[-1] == 15:
	print('DOWN')
elif a[-1] == 0:
	print('UP')
elif a[-2] < a[-1]:
	print('UP')
else:
	print('DOWN')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = LI()
	if a[-1] == 0:
		return 'UP'
	if a[-1] == 15:
		return 'DOWN'
	if n == 1:
		return -1
	if a[-2] > a[-1]:
		return 'DOWN'
	return 'UP'
print(main())


n = int(input())
li = list(map(int, input().split()))
if n == 1 and li[0] == 15:
	print('DOWN')
elif n == 1 and li[0] == 0:
	print('UP')
elif n == 1:
	print('-1')
else:
	for i in range(1, n):
		if li[i] > li[i - 1]:
			m = 1
		else:
			m = -1
	if m == 1 and li[-1] == 15:
		print('DOWN')
	elif m == 1:
		print('UP')
	elif m == -1 and li[-1] == 0:
		print('UP')
	else:
		print('DOWN')


def ans(n, seq):
	if n == 1:
		if seq[0] == 0:
			return 'UP'
		elif seq[0] == 15:
			return 'DOWN'
		else:
			return -1
	elif seq[-1] == 15:
		return 'DOWN'
	elif seq[-1] == 0:
		return 'UP'
	elif seq[-1] > seq[-2] and seq[-1] != 15:
		return 'UP'
	elif seq[-1] < seq[-2] and seq[-1] != 0:
		return 'DOWN'
n = int(input())
seq = list(map(int, input().split()))
print(ans(n, seq))


t = int(input())
size = list(map(int, input().split(' ')))
if size[t - 1] == 15:
	print('DOWN')
elif size[t - 1] == 0:
	print('UP')
elif t == 1:
	print(-1)
elif size[t - 1] > size[t - 2]:
	print('UP')
else:
	print('DOWN')


n = int(input())
l = [int(x) for x in input().split()]
ans = '-1'
if n > 1:
	if l[-1] > l[-2]:
		ans = 'UP'
	else:
		ans = 'DOWN'
	if not l[-1] * l[-2]:
		ans = 'UP'
if l[-1] == 15:
	ans = 'DOWN'
if l[-1] == 0:
	ans = 'UP'
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
if n == 1 and a[0] != 15 and (a[0] != 0):
	print('-1')
elif a[n - 1] == 15:
	print('DOWN')
elif a[n - 1] == 0 or a[n - 1] - a[n - 2] > 0:
	print('UP')
else:
	print('DOWN')


__author__ = 'artyom'

def main():
	n = read(1)
	if n == 1:
		z = read(1)
		if z == 0:
			return 0
		if z == 15:
			return 1
		return 2
	(a, b) = read(3)[-2:]
	if a < b:
		return 1 if b == 15 else 0
	return 0 if b == 0 else 1

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
write(['UP', 'DOWN', '-1'][main()])


input()
moon = [int(z) for z in input().split()]
moon = moon[::-1]
if moon.__len__() < 2:
	if moon[0] == 0:
		print('UP')
	elif moon[0] == 15:
		print('DOWN')
	else:
		print(-1)
elif moon[0] == 15:
	print('DOWN')
elif moon[0] == 0:
	print('UP')
elif moon[0] > moon[1]:
	print('UP')
elif moon[1] > moon[0]:
	print('DOWN')


n = int(input())
t = [int(i) for i in input().split()]
if n == 1 and t[n - 1] != 0 and (t[n - 1] != 15):
	print('-1')
if t[n - 1] == 15:
	print('DOWN')
if t[n - 1] == 0:
	print('UP')
if t[n - 1] > t[n - 2] and t[n - 1] != 15:
	print('UP')
if t[n - 1] < t[n - 2] and t[n - 1] != 0:
	print('DOWN')


import sys
n = int(input())
if n == 1:
	line = int(input())
	if line == 15:
		print('DOWN')
	elif line == 0:
		print('UP')
	else:
		print(-1)
	sys.exit()
line = list(map(int, input().split()))
if line[-2] < line[-1] != 15 or line[-1] == 0:
	print('UP')
else:
	print('DOWN')


n = int(input())
a = list(map(int, input().split()))
if n == 1:
	if a[0] == 15:
		print('DOWN')
		raise SystemExit
	elif a[0] == 0:
		print('UP')
		raise SystemExit
	else:
		print(-1)
		raise SystemExit
if a[-1] > a[-2]:
	if a[-1] != 15:
		print('UP')
		raise SystemExit
	else:
		print('DOWN')
		raise SystemExit
if a[-1] < a[-2]:
	if a[-1] != 0:
		print('DOWN')
		raise SystemExit
	else:
		print('UP')
		raise SystemExit


n = int(input())
nums = list(map(lambda x: int(x), input().split(' ')))
flag = False
is_up = False
is_down = False
if n == 1:
	if nums[0] == 0:
		print('UP')
	elif nums[0] == 15:
		print('DOWN')
	else:
		print(-1)
for i in range(n - 1):
	if nums[i] < nums[i + 1]:
		is_up = True
		is_down = False
	if nums[i] > nums[i + 1]:
		is_down = True
		is_up = False
	if nums[i + 1] == 15:
		is_down = True
		is_up = False
	if nums[i] == 1 and nums[i + 1] == 0:
		is_down = False
		is_up = True
if is_up == True:
	print('UP')
if is_down == True:
	print('DOWN')


n = int(input())
days = [int(x) for x in input().split()]
status = 'DOWN'
if days[-1] == 15:
	status = 'DOWN'
elif days[-1] == 0:
	status = 'UP'
elif n == 1:
	status = '-1'
elif days[-1] > days[-2]:
	status = 'UP'
print(status)


n = int(input())
ls = list(map(int, input().split()))
if n == 1:
	if ls[0] == 15:
		print('DOWN')
	elif not ls[0]:
		print('UP')
	else:
		print(-1)
elif ls[-2] > ls[-1]:
	if ls[-1]:
		print('DOWN')
	else:
		print('UP')
elif ls[-1] != 15:
	print('UP')
else:
	print('DOWN')


c = int(input())
a = input()
a = a.split()
con = 0
for k in range(len(a)):
	a[k] = int(a[k])
if c == 1:
	if a[0] >= 1 and a[0] < 15:
		print(-1)
	elif a[0] == 0:
		print('UP')
	else:
		print('DOWN')
elif a[c - 1] == 15:
	print('DOWN')
elif a[c - 1] == 0:
	print('UP')
elif a[c - 2] > a[c - 1]:
	print('DOWN')
else:
	print('UP')


input()
data = [int(info) for info in input().split(' ')]
if len(data) < 2:
	if data[0] == 0:
		print('UP')
	elif data[0] == 15:
		print('DOWN')
	else:
		print(-1)
elif data[-1] > data[-2]:
	if data[-1] == 15:
		print('DOWN')
	else:
		print('UP')
elif data[-1] == 0:
	print('UP')
else:
	print('DOWN')


tmp = input()
l = int(tmp)
arr = input().split()
if int(arr[l - 1]) == 15:
	print('DOWN')
elif int(arr[l - 1]) == 0:
	print('UP')
elif l < 2:
	print('-1')
elif int(arr[l - 1]) > int(arr[l - 2]):
	print('UP')
else:
	print('DOWN')


n = int(input())
l = list(map(int, input().split()))
done = 0
if n == 1:
	if l[0] == 15:
		done = 1
	elif l[0] == 0:
		done = 0
	else:
		done = 2
elif l[n - 1] == 15:
	done = 1
elif l[n - 1] == 0:
	done = 0
else:
	for i in range(n - 1):
		if l[i] > l[i + 1]:
			done = 1
		elif l[i] < l[i + 1]:
			done = 0
if done == 1:
	print('DOWN')
elif done == 2:
	print(-1)
else:
	print('UP')


from sys import stdin
n = int(stdin.readline())
nums = list(map(int, stdin.readline().rstrip().split(' ')))
if len(nums) == 1:
	if nums[0] == 0:
		print('UP')
	elif nums[0] == 15:
		print('DOWN')
	else:
		print(-1)
elif nums[-2] == 1 and nums[-1] == 0:
	print('UP')
elif nums[-2] > nums[-1]:
	print('DOWN')
elif nums[-1] == 15:
	print('DOWN')
else:
	print('UP')


_ANS0X1 = ['UP', 'DOWN', -1]
_X01 = int(input())
_X02 = list(map(int, input().split()))
if _X02[_X01 - 1] == 15:
	print(_ANS0X1[1])
elif _X02[_X01 - 1] == 0:
	print(_ANS0X1[0])
elif _X01 == 1:
	print(_ANS0X1[2])
else:
	print(_ANS0X1[0] if _X02[_X01 - 1] > _X02[_X01 - 2] else _ANS0X1[1])


n = int(input())
if n == 1:
	a = int(input())
	if a == 0:
		print('UP')
	elif a == 15:
		print('DOWN')
	else:
		print(-1)
else:
	a = input().split()
	if int(a[len(a) - 1]) == 15:
		print('DOWN')
	elif int(a[len(a) - 1]) == 0:
		print('UP')
	elif int(a[len(a) - 1]) > int(a[len(a) - 2]):
		print('UP')
	else:
		print('DOWN')


n = int(input()) - 1
cycle = list(map(int, input().split()))
if n != 0:
	if cycle[n] - cycle[n - 1] < 0 and cycle[n] != 0 or cycle[n] == 15:
		print('DOWN')
	else:
		print('UP')
elif cycle[n] == 15 and n == 0:
	print('DOWN')
elif cycle[n] == 0 and n == 0:
	print('UP')
else:
	print('-1')


n = int(input())
a = [int(_) for _ in input().split()]
if a[-1] == 15:
	print('DOWN')
elif a[-1] == 0:
	print('UP')
elif n == 1:
	print(-1)
elif a[-1] > a[-2]:
	print('UP')
else:
	print('DOWN')


import sys
import math
import bisect

def solve(A):
	n = len(A)
	if n == 1:
		if A[0] == 0:
			return 'UP'
		elif A[0] == 15:
			return 'DOWN'
		else:
			return -1
	else:
		if A[-1] == 0:
			return 'UP'
		if A[-1] == 15:
			return 'DOWN'
		if A[-1] > A[-2]:
			return 'UP'
		if A[-1] < A[-2]:
			return 'DOWN'
	return None

def main():
	n = int(input())
	A = list(map(int, input().split()))
	print(solve(A))
main()


n = int(input())
days = list(map(int, input().split()))
a = days[0]
up = False
down = False
if n > 1 and days[n - 2] > days[n - 1]:
	down = True
	up = False
elif n > 1:
	up = True
	down = False
if days[n - 1] is 15:
	down = True
	up = False
elif days[n - 1] is 0:
	up = True
	down = False
if up is True:
	print('UP')
elif down is True:
	print('DOWN')
else:
	print('-1')


n = int(input())
z = list(map(int, input().split()))
if z[-1] == 15:
	f = 0
elif z[-1] == 0:
	f = 1
elif n == 1:
	f = 2
elif z[-2] > z[-1]:
	f = 0
else:
	f = 1
print(['DOWN', 'UP', '-1'][f])


n = int(input())
(*a,) = map(int, input().split())
d = True
if len(a) == 1 and a[0] < 15 and (a[0] > 0):
	print('-1')
	quit()
elif a[n - 1] == 0:
	d = False
elif a[n - 1] != 15:
	d = a[n - 2] > a[n - 1]
print('DUOPW N'[not d::2])


maximum = 15
minimum = 0
n = int(input())
a = list(map(int, input().split()))
if n == 1:
	if a[0] == minimum:
		print('UP')
	elif a[0] == maximum:
		print('DOWN')
	else:
		print(-1)
else:
	(x1, x2) = a[-2:]
	if x1 < x2:
		if x2 < maximum:
			print('UP')
		else:
			print('DOWN')
	elif x2 > minimum:
		print('DOWN')
	else:
		print('UP')


def main():
	from sys import stdin, stdout
	n = int(stdin.readline())
	tup = tuple(map(int, stdin.readline().split()))
	if n == 1:
		if tup[0] == 0:
			stdout.write('UP')
		elif tup[0] == 15:
			stdout.write('DOWN')
		else:
			stdout.write('-1')
	elif tup[-1] - tup[-2] > 0:
		if tup[-1] == 15:
			stdout.write('DOWN')
		else:
			stdout.write('UP')
	elif tup[-1] == 0:
		stdout.write('UP')
	else:
		stdout.write('DOWN')
main()


def main():
	n = int(input())
	days = list(map(int, input().split()))
	if n == 1:
		if days[0] == 15:
			print('DOWN')
		elif days[0] == 0:
			print('UP')
		else:
			print(-1)
		return
	moves = [1, -1]
	now = 0
	last = days[0]
	if days[1] < days[0]:
		now = (now + 1) % 2
	for i in range(1, n):
		last += moves[now]
		if last == 0 or last == 15:
			now = (now + 1) % 2
	if now == 1:
		print('DOWN')
	else:
		print('UP')
main()


n = int(input())
line = str(input()).split()
if int(line[-1]) == 15:
	print('DOWN')
elif int(line[-1]) == 0:
	print('UP')
elif n > 1:
	if int(line[-1]) > int(line[-2]):
		print('UP')
	else:
		print('DOWN')
else:
	print(-1)


def main():
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(('UP', 'DOWN')[l[0] == 15] if not l[0] % 15 else -1)
	else:
		print(('UP', 'DOWN')[l[-1] - l[-2] < 0 < l[-1] or l[-1] == 15])
main()


input()
arr = [int(i) for i in input().split()]
if arr[-1] == 15:
	print('DOWN')
elif arr[-1] == 0:
	print('UP')
elif len(arr) == 1:
	print('-1')
elif arr[-1] > arr[-2]:
	print('UP')
else:
	print('DOWN')


n = int(input())
mas = input().split()
for i in range(n):
	mas[i] = int(mas[i])
if len(mas) == 1 and mas[0] != 15 and (mas[0] != 0):
	print('-1')
elif len(mas) == 1 and mas[0] == 15:
	print('DOWN')
elif len(mas) == 1 and mas[0] == 0:
	print('UP')
else:
	t = True
	for i in range(n - 1):
		if mas[i] > mas[i + 1]:
			t = False
		else:
			t = True
	if mas[n - 1] == 15:
		print('DOWN')
	elif mas[n - 1] == 0:
		print('UP')
	elif t == True:
		print('UP')
	else:
		print('DOWN')


a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
b = a[15:len(a)]
x = int(input())
nums = [int(n) for n in input().split()]
if x == 1:
	if nums[0] == 0:
		print('UP')
	elif nums[0] == 15:
		print('DOWN')
	else:
		print('-1')
elif nums[x - 1] == 0:
	print('UP')
elif nums[x - 1] == 15:
	print('DOWN')
elif nums[x - 2] == 15 and nums[x - 1] == 14:
	print('DOWN')
elif nums[x - 2] < nums[x - 1]:
	if a[a.index(nums[x - 1]) + 1] > a[a.index(nums[x - 1])]:
		print('UP')
elif nums[x - 2] > nums[x - 1]:
	if b[a.index(nums[x - 1]) + 1] < b[a.index(nums[x - 1])]:
		print('DOWN')


def main():
	n = int(input())
	a = [int(s) for s in input().split()]
	if a[-1] == 15:
		print('DOWN')
		return
	if a[-1] == 0:
		print('UP')
		return
	if n == 1:
		print(-1)
		return
	if a[-2] < a[-1]:
		print('UP')
		return
	else:
		print('DOWN')
		return
main()


n = int(input())
arr = list(map(int, input().split()))
if n == 1:
	if arr[0] == 0:
		print('UP')
	elif arr[0] == 15:
		print('DOWN')
	else:
		print(-1)
else:
	(a, b) = (arr[-2], arr[-1])
	if a < b:
		if b == 15:
			print('DOWN')
		else:
			print('UP')
	elif b == 0:
		print('UP')
	else:
		print('DOWN')


nums = input().split(' ')
nums = int(nums[0])
ks = input().split(' ')
ks = [int(ks[i]) for i in range(nums)]
if nums == 1:
	if ks[-1] == 15:
		print('DOWN')
	elif ks[0] == 0:
		print('UP')
	else:
		print('-1')
elif nums > 1:
	if ks[-1] == 15:
		print('DOWN')
	elif ks[-1] > ks[-2]:
		print('UP')
	elif ks[-1] < ks[-2]:
		if ks[-1] == 0:
			print('UP')
		else:
			print('DOWN')


n = int(input())
s = list(map(int, input().split()))
p = None
d = s[n - 1] - s[n - 2]
n1 = s[n - 1] + d
if n1 > s[n - 1] and n1 <= 15:
	p = 'UP'
elif n1 < s[n - 1] and n1 >= 0:
	p = 'DOWN'
elif s[n - 1] == 15:
	p = 'DOWN'
elif s[n - 1] == 0:
	p = 'UP'
else:
	p = -1
if len(s) == 1 and (s[n - 1] != 15 and s[n - 1] != 0):
	p = -1
print(p)


input()
L = [int(e) for e in input().split(' ')]
if len(L) == 1:
	if L[0] == 0:
		print('UP')
	elif L[0] == 15:
		print('DOWN')
	else:
		print(-1)
elif L[-1] > L[-2]:
	if L[-1] == 15:
		print('DOWN')
	else:
		print('UP')
elif L[-1] == 0:
	print('UP')
else:
	print('DOWN')


n = int(input())
A = input().split()
for i in range(n):
	A[i] = int(A[i])
if n == 1:
	if A[0] == 15:
		print('DOWN')
	elif A[0] == 0:
		print('UP')
	else:
		print('-1')
elif A[n - 1] == 15:
	print('DOWN')
elif A[n - 1] == 0:
	print('UP')
elif A[n - 1] > A[n - 2]:
	print('UP')
else:
	print('DOWN')


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
ips = lambda : input().split()
t = 1
for _ in range(t):
	n = ii()
	a = ll()
	if a[n - 1] == 15:
		print('DOWN')
	elif a[n - 1] == 0:
		print('UP')
	elif n == 1:
		print(-1)
	elif a[n - 1] > a[n - 2]:
		print('UP')
	else:
		print('DOWN')


import sys
n = int(input())
s = input()
li = []
li = s.split(' ')
for i in range(len(li)):
	li[i] = int(li[i])
if len(li) == 1:
	if li[0] == 0:
		print('UP')
	elif li[0] == 15:
		print('DOWN')
	else:
		print('-1')
elif li[len(li) - 1] == 0:
	print('UP')
elif li[len(li) - 1] == 15:
	print('DOWN')
elif li[len(li) - 1] - li[len(li) - 2] == -1:
	print('DOWN')
else:
	print('UP')


n = int(input())
a = list(map(int, input().split()))
if n == 1:
	if a[-1] == 15:
		print('DOWN')
	elif a[-1] == 0:
		print('UP')
	else:
		print(-1)
	exit()
f1 = a[-1] > a[-2] and a[-1] != 15
f2 = a[-1] == 0
print('UP' if f1 or f2 else 'DOWN')


a = int(input())
b = input().strip().split()
keep = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
keep2 = int(b[0])
check = True
for i in b:
	if int(b[len(b) - 1]) == 15:
		out = 'DOWN'
	elif int(b[len(b) - 1]) == 0:
		out = 'UP'
	elif int(i) - keep2 == 1:
		out = 'UP'
		keep2 = int(i)
		if int(i) == 15 and len(b) != 1:
			out = 'DOWN'
	elif int(i) - keep2 == -1:
		out = 'DOWN'
		keep2 = int(i)
		if int(i) == 15 and len(b) != 1:
			out = 'UP'
	else:
		out = -1
print(out)


no_days = int(input())
samples = [int(inline) for inline in input().split()]
if no_days == 1:
	if samples[0] == 0:
		print('UP')
	elif samples[0] == 15:
		print('DOWN')
	else:
		print(-1)
else:
	for i in range(no_days - 1, 0, -1):
		if samples[i] > samples[i - 1]:
			if samples[i] != 15:
				print('UP')
				break
			else:
				print('DOWN')
				break
		elif samples[i] < samples[i - 1]:
			if samples[i] == 0:
				print('UP')
				break
			else:
				print('DOWN')
				break


n = int(input())
numbers = list(map(int, input().split()))
min_down = 0
max_up = 0
if len(numbers) == 1 and numbers[n - 1] != 15 and (numbers[n - 1] != 0):
	print(-1)
elif len(numbers) == 1 and numbers[n - 1] == 15:
	print('DOWN')
elif len(numbers) == 1 and numbers[n - 1] == 0:
	print('UP')
else:
	for index in range(n - 1):
		diff = numbers[index + 1] - numbers[index]
	if (diff == -1 or numbers[n - 1] == 15) and numbers[n - 1] != 0:
		print('DOWN')
	elif numbers[n - 1] == 0:
		print('UP')
	else:
		print('UP')


n = int(input())
a = list(map(int, input().split()))[-2:]
l = list(range(16))
l += l[-2::-1] + [1]
d = {(l[i], l[i + 1]): True if l[i + 2] > l[i + 1] else False for i in range(len(l) - 2)}
l = l[:-2]
if n == 1:
	a = a[0]
	if l.count(a) > 1:
		print(-1)
	else:
		print('UP' if l[l.index(a) + 1] > a else 'DOWN')
else:
	print('UP' if d[tuple(a)] else 'DOWN')


n = int(input())
mylist = list(map(int, input().split(' ')))
if 1 <= n and n <= 92 and (max(mylist) <= 15) and (min(mylist) >= 0):
	if n == 1:
		if mylist[0] == 0:
			print('UP')
		elif mylist[0] == 15:
			print('DOWN')
		else:
			print(-1)
	elif mylist[-1] > mylist[-2] and mylist[-1] != 15:
		print('UP')
	elif mylist[-1] == 0:
		print('UP')
	else:
		print('DOWN')


from sys import stdin

def main():
	(n,) = stdin_get_ints_from_line()
	x = stdin_get_ints_list_from_line()
	if x[-1] == 15:
		print('DOWN')
		exit()
	if x[-1] == 0:
		print('UP')
		exit()
	if n == 1:
		print('-1')
		exit()
	if x[-1] > x[-2]:
		print('UP')
	if x[-1] < x[-2]:
		print('DOWN')

def stdin_get_ints_from_line():
	return (int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_ints_list_from_line():
	return list((int(x) for x in stdin.readline().strip().split(' ')))

def stdin_get_string_from_line():
	return stdin.readline().strip()
main()


a = input()
b = list(map(int, input().split()))

def main():
	going = 0
	if len(b) < 2:
		if len(b) == 1:
			i = b.pop(0)
			if i == 0:
				return 'UP'
			if i == 15:
				return 'DOWN'
		return -1
	oldx = b.pop(0)
	if oldx < 0 or oldx > 15:
		return -1
	for x in b:
		if x < 0 or x > 15:
			return -1
		if abs(x - oldx) != 1:
			return -1
		else:
			if x > oldx and x != 15 or x == 0:
				if going == -1 and x != 0:
					return -1
				going = 1
			if x < oldx and x != 0 or x == 15:
				if going == 1 and x != 15:
					return -1
				going = -1
		oldx = x
	if going == 1:
		return 'UP'
	elif going == -1:
		return 'DOWN'
	else:
		return -1
print(main())


a = int(input())
strs = input().split(' ')
if a == 1:
	x = int(strs[0])
	if x == 15:
		print('DOWN')
	elif x == 0:
		print('UP')
	else:
		print('-1')
else:
	x = int(strs[len(strs) - 1])
	y = int(strs[len(strs) - 2])
	if x == 15:
		print('DOWN')
	elif x == 0:
		print('UP')
	elif x > y:
		print('UP')
	else:
		print('DOWN')


def main(n, a):
	for ai in a[-15:]:
		if ai == 15:
			return 'DOWN'
		if ai == 0:
			return 'UP'
	if n == 1:
		return '-1'
	if a[-1] > a[-2]:
		return 'UP'
	return 'DOWN'
print(main(int(input()), list(map(int, input().split(' ')))))


n = int(input())
r = list(map(int, input().split()))
if n == 1:
	if r[0] != 15 and r[0] != 0:
		exit(print(-1))
	elif r[0] == 15:
		exit(print('DOWN'))
	else:
		exit(print('UP'))
ans = ''
for i in range(n - 1):
	if r[i] < r[i + 1]:
		ans = 'UP'
	else:
		ans = 'DOWN'
if r[-1] == 15:
	exit(print('DOWN'))
if r[-1] == 0:
	exit(print('UP'))
print(ans)


n = int(input())
s = input()
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])
if len(a) == 1 and a[0] == 15:
	print('DOWN')
elif len(a) == 1 and a[0] == 0:
	print('UP')
elif len(a) == 1:
	print(-1)
elif a[len(a) - 1] > a[len(a) - 2] and a[len(a) - 1] == 15:
	print('DOWN')
elif a[len(a) - 1] > a[len(a) - 2] and a[len(a) - 1] < 15:
	print('UP')
elif a[len(a) - 1] < a[len(a) - 2] and a[len(a) - 1] == 0:
	print('UP')
elif a[len(a) - 1] < a[len(a) - 2] and a[len(a) - 1] > 0:
	print('DOWN')
else:
	print(-1)


def func(arr, n):
	if arr[-1] == 15:
		return 'DOWN'
	if arr[-1] == 0:
		return 'UP'
	if n <= 1:
		return -1
	if arr[-2] < arr[-1]:
		return 'UP'
	return 'DOWN'
n = int(input())
arr = list(map(int, input().split()))
print(func(arr, n))


n = int(input())
a = [int(i) for i in input().split()]
if len(a) == 1 and (a[-1] != 15 and a[-1] != 0):
	print(-1)
elif len(a) == 1 and a[-1] == 15:
	print('DOWN')
elif len(a) == 1 and a[-1] == 0:
	print('UP')
elif a[-1] == 15 or (a[-1] - a[-2] < 0 and a[-1] != 0):
	print('DOWN')
elif a[-1] == 0 or (a[-1] - a[-2] > 0 and a[-1] != 15):
	print('UP')


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
int1 = lambda x: int(x) - 1
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
ilelec = lambda : map(int1, input().split())
alelec = lambda : list(map(int1, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
N = int(input())
A = alele()
D = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3]
if N == 1:
	if A[0] == 0:
		print('UP')
	elif A[0] == 15:
		print('DOWN')
	else:
		print(-1)
else:
	x = A[-2]
	y = A[-1]
	for i in range(len(D) - 2):
		if D[i] == x and D[i + 1] == y:
			if D[i + 2] > y:
				print('UP')
			else:
				print('DOWN')
			exit(0)
	print(-1)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase
from fractions import *

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

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

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
a = array()
if a[-1] == 15:
	print('DOWN')
elif a[-1] == 0:
	print('UP')
elif n == 1:
	print(-1)
elif a[-1] > a[-2]:
	print('UP')
else:
	print('DOWN')


def findi(n, a):
	if a[-1] == 15:
		return 'DOWN'
	elif a[-1] == 0:
		return 'UP'
	elif len(a) == 1:
		return '-1'
	elif a[-1] > a[-2]:
		return 'UP'
	else:
		return 'DOWN'
n = int(input())
a = list(map(int, input().strip().split()))
print(findi(n, a))


I = input
n = int(I())
a = list(map(int, I().split()))
s = 'DOWN'
if a[-1] == 15:
	s = 'DOWN'
elif a[-1] == 0:
	s = 'UP'
elif n == 1:
	s = -1
elif a[-1] > a[-2]:
	s = 'UP'
print(s)


import sys, math
n = int(input())
z = list(map(int, input().split()))
if n == 1:
	if z[0] == 0:
		print('UP')
		sys.exit(0)
	if z[0] == 15:
		print('DOWN')
		sys.exit(0)
	print(-1)
	sys.exit(0)
if z[-1] == 0:
	print('UP')
	sys.exit(0)
if z[-1] == 15:
	print('DOWN')
	sys.exit(0)
z.append(z[-1] + z[-1] - z[-2])
if z[-1] > z[-2]:
	print('UP')
else:
	print('DOWN')


n = int(input().strip())
arr = [int(x) for x in input().strip().split(' ')]
if n == 1:
	if arr[0] == 0:
		print('UP')
	elif arr[0] == 15:
		print('DOWN')
	else:
		print(-1)
elif arr[n - 1] == 0:
	print('UP')
elif arr[n - 1] == 15:
	print('DOWN')
else:
	print('UP' if arr[n - 1] > arr[n - 2] else 'DOWN')


n = int(input())
i = 0
a = []
a = list(map(int, input().split()))
if a[n - 1] == 15:
	print('DOWN')
	import sys
	sys.exit()
elif a[n - 1] == 0:
	print('UP')
	import sys
	sys.exit()
elif n == 1:
	print('-1')
	import sys
	sys.exit()
elif a[n - 1] > a[n - 2]:
	print('UP')
else:
	print('DOWN')


n = int(input())
al = list(map(int, input().split()))
ans = 0
if n == 1:
	if al[0] == 0:
		ans = 1
	elif al[0] == 15:
		ans = 2
elif al[n - 1] == 15 or (al[n - 1] < al[n - 2] and al[n - 1] > 0):
	ans = 2
else:
	ans = 1
print([-1, 'UP', 'DOWN'][ans])


if input() == '1':
	a = int(input())
	print('UP' if a == 0 else 'DOWN' if a == 15 else -1)
else:
	(a, b) = map(int, input().split()[-2:])
	print('UP' if b > a and b < 15 or (a > b and b == 0) else 'DOWN')


q = int(input())
m = [int(i) for i in input().split(' ')]
if q > 1:
	if m[q - 1] == 15:
		print('DOWN')
	elif m[q - 1] == 0:
		print('UP')
	elif m[q - 1] > m[q - 2]:
		print('UP')
	elif m[q - 1] < m[q - 2]:
		print('DOWN')
	elif m[q - 1] == m[q - 2]:
		print('-1')
elif m[0] == 15:
	print('DOWN')
elif m[0] == 0:
	print('UP')
else:
	print('-1')


Y = lambda : list(map(int, input().split()))
N = lambda : int(input())
n = N()
a = Y()
if a[-1] == 0:
	print('UP')
elif a[-1] == 15:
	print('DOWN')
elif n == 1:
	print(-1)
else:
	print(['DOWN', 'UP'][a[-2] < a[-1]])


n = int(input())
inp = map(int, input().split())
arr = []
for line in inp:
	arr.append(line)
if arr[-1] == 15:
	print('DOWN')
elif arr[-1] == 0:
	print('UP')
elif n == 1:
	print(-1)
elif arr[-1] > arr[-2]:
	print('UP')
else:
	print('DOWN')


n = int(input())
l = list(map(int, input().split()))
if l[n - 1] == 15:
	print('DOWN')
	exit(0)
if l[n - 1] == 0:
	print('UP')
	exit(0)
if n == 1:
	print(-1)
	exit(0)
if l[n - 2] < l[n - 1]:
	print('UP')
	exit(0)
if l[n - 2] > l[n - 1]:
	print('DOWN')


import array as arr
n = int(input())
up_flag = False
down_flag = False
vis_size = list(map(int, input().strip().split()))[:n]
vis_arr = arr.array('i', vis_size)
if n == 1 and vis_arr[n - 1] == 15:
	print('DOWN')
elif n == 1 and vis_arr[n - 1] == 0:
	print('UP')
elif n == 1:
	print(-1)
else:
	for i in range(n - 1):
		if vis_arr[i + 1] > vis_arr[i]:
			up_flag = True
			down_flag = False
		elif vis_arr[i + 1] < vis_arr[i]:
			down_flag = True
			up_flag = False
	if vis_arr[n - 1] == 15:
		down_flag = True
		up_flag = False
	if vis_arr[n - 1] == 0:
		down_flag = False
		up_flag = True
	if up_flag and (not down_flag):
		print('UP')
	elif down_flag and (not up_flag):
		print('DOWN')


N = int(input())
X = list(map(int, input().split()))
if N == 1 or X[-1] in [0, 15]:
	print('DOWN' if X[-1] == 15 else 'UP' if X[-1] == 0 else -1)
	exit()
print('UP' if X[-1] - X[-2] > 0 and X[-1] != 15 else 'DOWN')


class CodeforcesTask719ASolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.moon = []

	def read_input(self):
		self.n = int(input())
		self.moon = [int(x) for x in input().split(' ')]

	def process_task(self):
		if self.moon[-1] == 0:
			self.result = 'UP'
		elif self.moon[-1] == 15:
			self.result = 'DOWN'
		elif self.n == 1:
			self.result = '-1'
		elif self.moon[-1] > self.moon[-2]:
			self.result = 'UP'
		else:
			self.result = 'DOWN'

	def get_result(self):
		return self.result
Solution = CodeforcesTask719ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input().strip())
li = list(map(int, input().strip().split()))
ans = 0
if n == 1:
	if li[0] == 0:
		ans = 1
	elif li[0] == 15:
		ans = 0
	else:
		ans = -1
else:
	(a, b) = li[-2:]
	if b == 15:
		ans = 0
	elif b == 0:
		ans = 1
	elif b - a < 0:
		ans = 0
	else:
		ans = 1
if ans == -1:
	print(ans)
elif ans == 0:
	print('DOWN')
else:
	print('UP')


n = int(input())
ai = [int(x) for x in input().split(' ')]
if ai[-1] == 0:
	print('UP')
	exit()
elif ai[-1] == 15:
	print('DOWN')
	exit()
if n == 1 and ai[0] not in [0, 15]:
	print(-1)
	exit()
k = ai[-2:]
if k[0] - k[1] > 0:
	print('DOWN')
else:
	print('UP')


import math, fractions
n = int(input())
q = [int(x) for x in input().split()]
if n == 1:
	if q[0] == 15:
		print('DOWN')
	elif q[0] == 0:
		print('UP')
	else:
		print(-1)
elif q[n - 2] < q[n - 1]:
	print('UP' if q[n - 1] != 15 else 'DOWN')
else:
	print('DOWN' if q[n - 1] != 0 else 'UP')


n = int(input())
A = list(map(int, input().split()))
if n == 1:
	if A[0] == 15:
		print('DOWN')
	elif A[0] == 0:
		print('UP')
	else:
		print(-1)
else:
	per = A[-1]
	per2 = A[-2]
	if per == 15:
		print('DOWN')
	elif per == 0:
		print('UP')
	elif per > per2:
		print('UP')
	else:
		print('DOWN')


a = int(input())
b = list((int(x) for x in input().split()))
if b[-1] == 15:
	print('DOWN')
elif b[-1] == 0:
	print('UP')
elif a == 1:
	print(-1)
elif b[-1] > b[-2]:
	print('UP')
else:
	print('DOWN')


def A():
	n = int(input())
	if n == 1:
		item = int(input())
		if item == 0:
			print('UP')
		elif item == 15:
			print('DOWN')
		else:
			print('-1')
		return 0
	else:
		lst = [int(x) for x in input().split()]
	if lst[-2] > lst[-1] and lst[-1] != 0:
		print('DOWN')
	elif lst[-2] > lst[-1]:
		print('UP')
	elif lst[-2] < lst[-1] and lst[-1] != 15:
		print('UP')
	else:
		print('DOWN')
	return 0
A()


import math, sys, re, itertools
(rs, ri, rai) = (input, lambda : int(input()), lambda : list(map(int, input().split())))
n = ri()
a = rai()
if a[-1] == 0:
	print('UP')
elif a[-1] == 15:
	print('DOWN')
elif n == 1:
	print(-1)
else:
	(x, y) = a[-2:]
	print('UP' if y - x > 0 else 'DOWN')


import sys
i = lambda : int(sys.stdin.readline())
l = lambda : list(map(int, sys.stdin.readline().strip().split()))
n = i()
lst = l()
if n == 1:
	if lst[0] == 15:
		print('DOWN')
	elif lst[0] == 0:
		print('UP')
	else:
		print(-1)
else:
	(a, b) = (lst[-2], lst[-1])
	if a < b:
		if b == 15:
			print('DOWN')
		else:
			print('UP')
	elif b == 0:
		print('UP')
	else:
		print('DOWN')


n = int(input())
x = list(map(int, input().split(' ')))
if x[-1] == 15 or x[-1] == 0 or n == 1:
	print({15: 'DOWN', 0: 'UP'}[x[-1]] if x[-1] in [0, 15] else -1)
else:
	print('UP' if x[-1] > x[-2] else 'DOWN')


inp = input()
numbers = input().split()
if int(inp) == 1:
	if int(numbers[-1]) == 0:
		print('UP')
	elif int(numbers[-1]) == 15:
		print('DOWN')
	else:
		print(-1)
elif int(numbers[-1]) == 0:
	print('UP')
elif int(numbers[-1]) == 15:
	print('DOWN')
elif int(numbers[-1]) - int(numbers[-2]) > 0:
	print('UP')
else:
	print('DOWN')


x = int(input())
lista = list(map(int, input().split()))
if lista[-1] == 15:
	print('DOWN')
elif lista[-1] == 0:
	print('UP')
elif x == 1:
	print(-1)
elif x > 1 and lista[-1] > lista[-2]:
	print('UP')
elif x > 1 and lista[-1] < lista[-2]:
	print('DOWN')


from sys import exit
n = int(input())
d = [int(z) for z in input().split()]
if d[-1] == 0:
	print('UP')
	exit(0)
if d[-1] == 15:
	print('DOWN')
	exit(0)
if n == 1:
	print(-1)
	exit(0)
if d[-1] > d[-2]:
	print('UP')
	exit(0)
print('DOWN')


a = input()
moon = [int(x) for x in input().strip().split()]
if len(moon) == 1:
	if moon[0] == 0:
		print('UP')
	elif moon[0] == 15:
		print('DOWN')
	else:
		print(-1)
elif moon[len(moon) - 1] < moon[len(moon) - 2]:
	if moon[len(moon) - 1] == 0:
		print('UP')
	else:
		print('DOWN')
elif moon[len(moon) - 1] == 15:
	print('DOWN')
else:
	print('UP')


input()
arg = [int(i) for i in input().split()]
if len(arg) == 1:
	if arg[0] == 15:
		print('DOWN')
	elif arg[0] == 0:
		print('UP')
	else:
		print(-1)
elif arg[-1] == 0 or (arg[-1] > arg[-2] and arg[-1] != 15):
	print('UP')
else:
	print('DOWN')


n = int(input())
a = list(map(int, input().split(' ')))
l = a.pop()
if l == 15:
	print('DOWN')
elif l == 0:
	print('UP')
elif n == 1:
	print(-1)
else:
	p = a.pop()
	print('UP' if p < l else 'DOWN')


n = int(input())
a = list(map(int, input().split()))
otvet = 0
if len(a) == 1:
	if a[0] == 0:
		otvet = 'UP'
	elif a[0] == 15:
		otvet = 'DOWN'
	else:
		otvet = '-1'
elif a[0] > a[-1] and (not 0 in a) or a[-1] == 15 or (a[-1] - a[-2] < 0 and a[-1] != 0):
	otvet = 'DOWN'
elif a[0] < a[-1] and a[-1] != 15 or a[-1] >= 0 or a[-1] - a[-2] > 0:
	otvet = 'UP'
print(otvet)


n = int(input())
a = list(map(int, input().split()))
if n < 2:
	if a[0] == 15:
		print('DOWN')
	elif a[0] == 0:
		print('UP')
	else:
		print(-1)
elif a[-1] < a[-2]:
	if a[-1] != 0:
		print('DOWN')
	else:
		print('UP')
elif a[-1] == max(a) and a.index(max(a)) != n - 1 or a[-1] == 15:
	print('DOWN')
else:
	print('UP')


import math, bisect, heapq, random, sys, itertools
input = sys.stdin.readline
ints = lambda : list(map(int, input().split()))
p = 10 ** 9 + 7
n = int(input())
a = ints()
if n == 1:
	if a[0] == 0:
		print('UP')
	elif a[0] == 15:
		print('DOWN')
	else:
		print('-1')
else:
	a = a[len(a) - 2:]
	if a[1] == 0:
		print('UP')
	elif a[1] == 15:
		print('DOWN')
	elif a[0] < a[1]:
		print('UP')
	else:
		print('DOWN')


def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

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

def ar(element, size):
	return [element for i in range(size)]

def yes():
	print('Yes')

def no():
	print('No')

def interval(i1, i2):
	return range(i1, i2 + 1)
Testcase = 1
for _ in range(Testcase):
	n = inin()
	a = [0] + inar()
	pattern = 'increasing'
	if n == 1:
		if a[1] == 15:
			print('DOWN')
		elif a[1] == 0:
			print('UP')
		else:
			print(-1)
	else:
		for i in interval(2, n):
			if a[i] > a[i - 1]:
				pattern = 'inc'
			else:
				pattern = 'dec'
		if pattern == 'inc':
			if a[-1] == 15:
				print('DOWN')
			else:
				print('UP')
		elif a[-1] == 0:
			print('UP')
		else:
			print('DOWN')


n = int(input())
lis = list(map(int, input().split()))
n -= 1
if n == 0:
	if lis[0] == 15:
		print('DOWN')
	elif lis[0] == 0:
		print('UP')
	else:
		print(-1)
elif lis[n] == 15:
	print('DOWN')
elif lis[n] == 0:
	print('UP')
elif n == 0:
	print(-1)
elif lis[n - 1] > lis[n]:
	print('DOWN')
else:
	print('UP')


def phases(lst):
	if len(lst) == 1 and lst[len(lst) - 1] == 15:
		return 'DOWN'
	if len(lst) == 1 and lst[len(lst) - 1] == 0:
		return 'UP'
	if len(lst) == 1:
		return -1
	if lst[len(lst) - 1] == 15:
		return 'DOWN'
	elif lst[len(lst) - 1] == 0:
		return 'UP'
	elif lst[len(lst) - 1] > lst[len(lst) - 2]:
		return 'UP'
	elif lst[len(lst) - 1] < lst[len(lst) - 2]:
		return 'DOWN'
n = int(input())
a = [int(i) for i in input().split()]
print(phases(a))


n = int(input())
a = list(map(int, input().split()))
v = True
for i in range(n - 1):
	if a[i] < a[i + 1]:
		v = True
	else:
		v = False
if len(a) > 1 or (len(a) == 1 and (a[0] == 0 or a[0] == 15)):
	if v:
		if a[n - 1] != 15:
			print('UP')
		else:
			print('DOWN')
	elif a[n - 1] != 0:
		print('DOWN')
	else:
		print('UP')
else:
	print(-1)


from sys import exit
n = int(input())
t = [int(x) for x in input().split()]
if n == 1:
	if t[0] == 15:
		print('DOWN')
	elif t[0] == 0:
		print('UP')
	else:
		print(-1)
	exit()
if t[n - 1] - t[n - 2] > 0:
	if t[n - 1] == 15:
		print('DOWN')
	else:
		print('UP')
elif t[n - 1] - t[n - 2] < 0:
	if t[n - 1] == 0:
		print('UP')
	else:
		print('DOWN')


n = int(input())
a = list(map(int, input().split()))
if len(a) == 1:
	print(-1 if a[0] != 15 and a[0] != 0 else 'UP' if a[0] == 0 else 'DOWN')
	exit()
if a[-1] < 15 and (a[-1] == 0 or a[-1] > a[-2]):
	print('UP')
else:
	print('DOWN')


__author__ = 'Esfandiar'
n = int(input())
a = list(map(int, input().split()))
if n == 1:
	print('DOWN' if a[0] == 15 else 'UP' if a[0] == 0 else -1)
	exit()
if a[-1] > a[-2]:
	if a[-1] != 15:
		print('UP')
	else:
		print('DOWN')
elif a[-1] == 0:
	print('UP')
else:
	print('DOWN')


import logging
import copy
import sys
import math
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)

def solve(nums):
	if len(nums) < 1:
		return -1
	if len(nums) == 1:
		if nums[0] == 15:
			return 'DOWN'
		elif nums[0] == 0:
			return 'UP'
		return -1
	last = nums[len(nums) - 1]
	prev = nums[len(nums) - 2]
	if last > prev:
		if last != 15:
			return 'UP'
		return 'DOWN'
	if last == 0:
		return 'UP'
	return 'DOWN'

def main():
	firstLine = int(input())
	line = input().split()
	line = list(map(int, line))
	print(solve(line))

def log(*message):
	logging.debug(message)
main()


import sys

def main():
	n = int(sys.stdin.readline())
	moon = [int(x) for x in sys.stdin.readline().split()]
	if n is 1:
		if moon[0] == 15:
			print('DOWN')
		elif moon[0] == 0:
			print('UP')
		else:
			print(-1)
	else:
		last1 = moon[n - 1]
		last2 = moon[n - 2]
		if last1 != 0 and last1 != 15:
			if last2 > last1:
				print('DOWN')
			else:
				print('UP')
		elif last1 == 15:
			print('DOWN')
		elif last1 == 0 and last2 == 1:
			print('UP')
		else:
			print('DOWN')
main()


i = input()
i = int(i)
x = [int(i) for i in input().split()]
if i == 1 and x[i - 1] == 15:
	print('DOWN')
elif i == 1 and x[i - 1] == 0:
	print('UP')
elif i <= 1:
	print('-1')
elif x[i - 1] == 15 and x[i - 2] == 14:
	print('DOWN')
elif x[i - 1] == 0 and x[i - 2] == 1:
	print('UP')
elif x[i - 1] > x[i - 2]:
	print('UP')
elif x[i - 1] < x[i - 2]:
	print('DOWN')


l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
input()
s = list(map(int, input().split()))
if len(s) == 1:
	if s[0] == 15:
		print('DOWN')
	elif s[0] == 0:
		print('UP')
	else:
		print('-1')
else:
	a = s[len(s) - 2]
	b = s[len(s) - 1]
	if a == 1 and b == 0:
		print('UP')
	elif a == 14 and b == 15:
		print('DOWN')
	elif b > a:
		print('UP')
	else:
		print('DOWN')


s = '012345678910111213141514131211109876543210'
b = int(input())
d = list(input().split())
a = ''.join(d)
if b >= 2:
	c = ''.join(d[b - 2] + d[b - 1])
if b == 1 and a[:] == '0':
	print('UP')
elif b == 1 and a[:] != '0' and (a[:] != '15'):
	print('-1')
elif b == 1 and a[:] == '15':
	print('DOWN')
elif c == '21':
	print('DOWN')
else:
	print('DOWN' if s.find(c) + len(c) - 1 >= 21 and s.find(c) + len(c) - 1 < 41 else 'UP')


n = int(input())
lis = list(map(int, input().split()))
if n == 1:
	if lis[0] == 15:
		print('DOWN')
	elif lis[0] == 0:
		print('UP')
	else:
		print(-1)
else:
	res = ''
	for i in range(n - 1):
		if lis[i + 1] > lis[i] and lis[i + 1] != 15:
			res = 'UP'
		elif lis[i + 1] == 0:
			res = 'UP'
		else:
			res = 'DOWN'
	print(res)


import sys
n = int(input())
s = list(map(int, input().split()))
if n == 1 and s[0] != 15 and (s[0] != 0):
	print(-1)
	sys.exit()
if n != 1 and s[-1] > s[-2] and (s[-1] != 15) or s[len(s) - 1] == 0:
	print('UP')
else:
	print('DOWN')


arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
n = int(input())
prr = [int(x) for x in input().split()]
if n == 1:
	a = prr[0]
	if a == 0:
		print('UP')
	elif a == 15:
		print('DOWN')
	else:
		print(-1)
else:
	(a, b) = (prr[n - 2], prr[n - 1])
	c = b - a
	if c == 1:
		if b != 15:
			print('UP')
		else:
			print('DOWN')
	elif b != 0:
		print('DOWN')
	else:
		print('UP')


n = int(input())
a = list(map(int, input().split()))
if n == 1:
	if a[0] == 0:
		print('UP')
	elif a[0] == 15:
		print('DOWN')
	else:
		print(-1)
elif a[n - 1] == 15:
	print('DOWN')
elif a[n - 1] == 0:
	print('UP')
else:
	for i in range(n - 1):
		if a[i] < a[i + 1]:
			state = 'UP'
		else:
			state = 'DOWN'
	print(state)


n = int(input())
L = list(map(int, input().split()))
if n == 1:
	if L[0] == 0:
		print('UP')
	elif L[0] == 15:
		print('DOWN')
	else:
		print('-1')
else:
	d = L[n - 2] - L[n - 1]
	if d < 0:
		if L[n - 1] == 15:
			print('DOWN')
		else:
			print('UP')
	elif L[n - 1] == 0:
		print('UP')
	else:
		print('DOWN')


n = int(input())
a = list(map(int, input().split()))
up = down = False
for i in range(1, n):
	if a[i] > a[i - 1]:
		(up, down) = (True, False)
	if a[i] < a[i - 1]:
		(up, down) = (False, True)
if a[-1] == 0:
	print('UP')
elif a[-1] == 15:
	print('DOWN')
else:
	print('UP' if up else 'DOWN' if down else -1)


a = int(input())
b = input().split()
error = 0
if b[a - 1] == '0':
	print('UP')
	error = 1
if b[a - 1] == '15':
	print('DOWN')
	error = 1
if a == 1 and error == 0:
	print('-1')
	error = 1
if error == 0:
	if int(b[a - 1]) < int(b[a - 2]):
		print('DOWN')
	else:
		print('UP')


num = input()
record = list(map(int, input().split()))
if record[-1] == 15:
	print('DOWN')
elif record[-1] == 0:
	print('UP')
elif len(record) == 1:
	print(-1)
elif record[-1] - record[-2] > 0:
	print('UP')
else:
	print('DOWN')


n = int(input())
lst = [int(x) for x in input().split()]
flg = 0
ln = len(lst)
if ln == 1:
	flg = -1
elif lst[ln - 1] > lst[ln - 2]:
	flg = 0
else:
	flg = 1
if lst[ln - 1] == 15:
	flg = 1
elif lst[n - 1] == 0:
	flg = 0
if flg == 0:
	print('UP')
elif flg == 1:
	print('DOWN')
else:
	print('-1')


n = input()
n = int(n)
array = list(map(int, input().split()))
up = 'UP'
down = 'DOWN'
impos = '-1'
if len(array) == 1:
	if array[0] == 0:
		print(up)
	elif array[0] == 15:
		print(down)
	else:
		print(impos)
elif array[-1] == 0:
	print(up)
elif array[-1] == 15:
	print(down)
elif array[-1] > array[-2]:
	print(up)
else:
	print(down)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
MOON = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
N = int(input())
A = [int(x) for x in input().split()]
ans = 0
for start in range(len(MOON)):
	f = True
	for i in range(N):
		if MOON[(start + i) % len(MOON)] != A[i]:
			f = False
			break
	if f:
		m = MOON[(start + N) % len(MOON)]
		if m > A[-1]:
			if ans == -1:
				print(-1)
				exit(0)
			ans = 1
		elif m < A[-1]:
			if ans == 1:
				print(-1)
				exit(0)
			ans = -1
if ans == 0:
	print(-1)
elif ans == 1:
	print('UP')
else:
	print('DOWN')


import sys
n = int(input())
arr = list(map(int, input().split()))
if n == 1 and arr[-1] != 0 and (arr[-1] != 15):
	print('-1')
elif arr[-1] == 0:
	print('UP')
elif arr[-1] == 15:
	print('DOWN')
elif arr[-2] < arr[-1]:
	print('UP')
else:
	print('DOWN')


input()
mat = list(map(int, input().split()))
if mat[-1] == 15:
	print('DOWN')
elif mat[-1] == 0:
	print('UP')
elif len(mat) == 1:
	print(-1)
else:
	print('UP' if mat[-1] > mat[-2] else 'DOWN')


n = int(input())
a = input()
l = a.split(' ')
l1 = []
for i in l:
	l1.append(int(i))
e = -1
val = ''
count = 0
n1 = l1[0]
for i in range(1, len(l1)):
	if n1 < l1[i]:
		val = 'UP'
	else:
		val = 'DOWN'
	n1 = l1[i]
if len(l1) == 1 and n1 != 15 and (n1 != 0):
	print(e)
elif n1 == 0:
	val = 'UP'
elif n1 == 15:
	val = 'DOWN'
print(val)


n = int(input())
l = [int(i) for i in input().split()]
if n == 1:
	if l[0] == 15:
		print('DOWN')
	elif l[0] == 0:
		print('UP')
	else:
		print(-1)
elif all((l[i] > l[i - 1] for i in range(1, n))):
	if l[-1] == 15:
		print('DOWN')
	else:
		print('UP')
elif all((l[i] < l[i - 1] for i in range(1, n))):
	if l[-1] == 0:
		print('UP')
	else:
		print('DOWN')
elif l[-1] == 15:
	print('DOWN')
elif l[-1] == 0:
	print('UP')
else:
	i = n - 1
	if l[i] > l[i - 1]:
		print('UP')
	else:
		print('DOWN')


import sys, math
t = int(input())
a = list(map(int, input().split()))
if len(a) == 1 and a[0] != 15 and (a[0] != 0):
	print(-1)
elif a[t - 1] == 15 or (a[t - 1] < a[t - 2] and a[t - 1] != 0):
	print('DOWN')
else:
	print('UP')


from sys import stdin as fin
n = int(fin.readline())
nums = tuple(map(int, fin.readline().split()))
ans = {15: 'DOWN', 0: 'UP'}
if nums[-1] in ans:
	print(ans[nums[-1]])
elif len(nums) == 1:
	print(-1)
else:
	print('DOWN' if nums[-1] < nums[-2] else 'UP')


t = int(input())
a = list(map(int, input().split()))
last = a[-1]
if t == 1:
	if last == 15:
		print('DOWN')
	elif last == 0:
		print('UP')
	else:
		print(-1)
elif last > a[-2] and last != 15 or last == 0:
	print('UP')
else:
	print('DOWN')


n = int(input())
mas = input().split()
if n == 1:
	if int(mas[0]) == 15:
		print('DOWN')
	elif int(mas[0]) == 0:
		print('UP')
	elif True:
		print('-1')
elif int(mas[n - 1]) != 15 and int(mas[n - 1]) != 0:
	if int(mas[n - 1]) - int(mas[n - 2]) > 0:
		print('UP')
	else:
		print('DOWN')
elif int(mas[n - 1]) == 15:
	print('DOWN')
else:
	print('UP')


n = int(input())
X = [int(x) for x in input().split(' ')]
if n == 1:
	if X[0] == 0:
		print('UP')
	if X[0] == 15:
		print('DOWN')
	if X[0] != 0 and X[0] != 15:
		print(-1)
if n > 1:
	if X[-1] > X[-2]:
		if X[-1] == 15:
			print('DOWN')
		else:
			print('UP')
	if X[-2] > X[-1]:
		if X[-1] == 0:
			print('UP')
		else:
			print('DOWN')


n = int(input())
days = [int(bruh) for bruh in input().split()]
if days[-1] == 15:
	print('DOWN')
	exit()
if days[-1] == 0:
	print('UP')
	exit()
if len(days) == 1:
	print(-1)
	exit()
if days[-1] < days[-2]:
	print('DOWN')
	exit()
if days[-1] > days[-2]:
	print('UP')
	exit()


n = int(input())
a = input()
A = []
if a == '0' and n == 1:
	print('UP')
elif a == '15' and n == 1:
	print('DOWN')
elif n == 1 and a != '0' and (a != '15'):
	print(-1)
else:
	for i in a.split():
		A.append(int(i))
	if A[-1] == 0:
		print('UP')
	elif A[-1] == 15:
		print('DOWN')
	elif A[-1] > A[-2]:
		print('UP')
	elif A[-1] < A[-2]:
		print('DOWN')


n = int(input())
L = list(map(int, input().split()))
cnt = 0
if n == 1:
	if L[0] != 0 and L[0] != 15:
		print(-1)
	elif L[0] == 0:
		print('UP')
	elif L[0] == 15:
		print('DOWN')
else:
	cnt = L.count(15)
	A = []
	for (idx, elm) in enumerate(L):
		if elm == 15:
			A.append(idx)
	if L[n - 1] == 0:
		print('UP')
	elif cnt != 0:
		l = len(A) - 1
		index = A[l]
		dif = n - index
		if L[index] == L[n - 1]:
			print('DOWN')
			exit(0)
		if L[n - 2] > L[n - 1]:
			print('DOWN')
		elif L[n - 2] < L[n - 1]:
			print('UP')
	elif cnt == 0:
		if L[n - 2] > L[n - 1]:
			print('DOWN')
		elif L[n - 2] < L[n - 1]:
			print('UP')
	elif L[n - 1] == 15:
		print('DOWN')


n = int(input())
if n == 1:
	b = int(input())
	if b == 15:
		print('DOWN')
	elif b == 0:
		print('UP')
	else:
		print(-1)
else:
	x = [int(y) for y in input().split()]
	b = x[len(x) - 1]
	a = x[len(x) - 2]
	if b == 15:
		print('DOWN')
	elif b == 0:
		print('UP')
	elif a > b:
		print('DOWN')
	else:
		print('UP')


n = int(input())
zikl = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1] * 10
l = list(map(int, input().split()))
if n == 1:
	if l[0] == 0:
		print('UP')
	elif l[0] == 15:
		print('DOWN')
	else:
		print(-1)
	exit()
for i in range(len(zikl)):
	curr = 0
	for j in range(len(l)):
		if zikl[i + j] == l[j]:
			curr += 1
	if curr == n:
		if zikl[i + n] > zikl[i + n - 1]:
			print('UP')
			exit()
		else:
			print('DOWN')
			exit()


n = int(input())
s = list(map(int, input().split()))
if len(s) == 1 and s[0] != 0 and (s[0] != 15):
	print(-1)
elif len(s) == 1 and s[0] == 15:
	print('DOWN')
elif len(s) == 1 and s[0] == 0:
	print('UP')
elif s[-1] > s[-2] and s[-1] != 15 or s[-1] == 0:
	print('UP')
elif s[-1] < s[-2] or s[-1] == 15:
	print('DOWN')


x = int(input())
a = list(map(int, input().split()))

def nextMoon(pole):
	if a[len(a) - 1] == 0:
		return 'UP'
	if a[len(a) - 1] == 15:
		return 'DOWN'
	if len(a) == 1:
		return -1
	if a[len(a) - 1] < a[len(a) - 2]:
		return 'DOWN'
	if a[len(a) - 1] > a[len(a) - 2]:
		return 'UP'
print(nextMoon(a))


n = int(input())
lst = [int(x) for x in input().split()]
if lst[-1] is 15:
	print('DOWN')
elif lst[-1] is 0:
	print('UP')
elif n is 1:
	print('-1')
elif lst[-1] > lst[-2]:
	print('UP')
else:
	print('DOWN')


counter = int(input())
a_list = list(map(int, input().split()))
state = 'DOWN'
if a_list[-1] == 15:
	state = 'DOWN'
elif a_list[-1] == 0:
	state = 'UP'
elif counter == 1:
	state = -1
elif a_list[-1] > a_list[-2]:
	state = 'UP'
print(state)


a = int(input())
x = list(map(int, input().split()))
if a == 1 and x[0] != 0 and (x[0] != 15):
	print(-1)
elif a == 1 and x[0] == 0:
	print('UP')
elif a == 1 and x[0] == 15:
	print('DOWN')
else:
	k = 0
	l = 0
	for i in range(1, a):
		k = x[i]
		l = x[i - 1]
	if k - l > 0 and k == 15:
		print('DOWN')
	elif k - l > 0:
		print('UP')
	if k - l < 0 and k == 0:
		print('UP')
	elif k - l < 0:
		print('DOWN')


n = int(input())
days = [int(x) for x in input().split()]
up = True
if n == 1:
	if days[0] == 0:
		print('UP')
	elif days[0] == 15:
		print('DOWN')
	else:
		print(-1)
else:
	yesterday = days[0]
	for i in range(1, n):
		today = days[i]
		if today > yesterday:
			up = True
		else:
			up = False
		if today == 15 or today == 0:
			up = not up
		yesterday = today
	if up:
		print('UP')
	else:
		print('DOWN')


import math

def get_primes(prime_supr):
	is_prime = [0] * 2 + [1] * prime_supr
	for i in range(2, int(math.sqrt(prime_supr)) + 1):
		if is_prime[i]:
			for j in range(i * i, prime_supr + 1, i):
				is_prime[j] = 0
	return is_prime
get_int = lambda : map(int, input().split())
n = int(input())
d = list(get_int())
ans = ['DOWN', '-1', 'UP']
if d[-1] == 0:
	print(ans[2])
elif d[-1] == 15:
	print(ans[0])
elif n > 1:
	print(ans[d[-1] - d[-2] + 1])
else:
	print(ans[1])


n = input()
list1 = []
str = input()
if n is '1':
	list1 = str.split()
	if int(list1[0]) is 15:
		print('DOWN')
	elif int(list1[0]) is 0:
		print('UP')
	else:
		print(-1)
else:
	list1 = str.split()
	if int(list1[int(n) - 1]) > int(list1[int(n) - 2]):
		if int(list1[int(n) - 1]) is 15:
			print('DOWN')
		else:
			print('UP')
	elif int(list1[int(n) - 1]) is 0:
		print('UP')
	else:
		print('DOWN')


n = int(input())
w = input().split()
w = list(w)
if n == 1:
	if w[-1] == '15':
		print('DOWN')
	elif w[-1] == '0':
		print('UP')
	else:
		print('-1')
elif w[-1] == '15':
	print('DOWN')
elif w[-1] == '0':
	print('UP')
elif int(w[-1]) < int(w[-2]):
	print('DOWN')
elif int(w[-1]) > int(w[-2]):
	print('UP')


n = input()
a = list(map(int, input().split(' ')))
cycle = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
cycle = cycle * (len(a) // len(cycle) + 2)
res = []
i = 0
for i in range(len(cycle) - len(a)):
	found = True
	for d in range(len(a)):
		if i + d >= len(cycle) or a[d] != cycle[i + d]:
			found = False
			break
	if found:
		res.append(cycle[i + len(a)])
if len(set(res)) != 1:
	print(-1)
elif res[0] > a[len(a) - 1]:
	print('UP')
else:
	print('DOWN')


t = input
p = print
r = range
n = int(t())
a = list(map(int, t().split()))
ans = -1
if n > 1:
	last = a[-1]
	pre_last = a[-2]
	if last > pre_last:
		ans = 'UP'
	else:
		ans = 'DOWN'
	if last == 0 and pre_last == 1:
		ans = 'UP'
	if last == 15 and pre_last == 14:
		ans = 'DOWN'
else:
	if a[0] == 0:
		ans = 'UP'
	if a[0] == 15:
		ans = 'DOWN'
print(ans)


n = int(input())
a = [int(i) for i in input().split()]
if a[n - 1] == 15:
	print('DOWN')
	exit(0)
if a[n - 1] == 0:
	print('UP')
	exit(0)
if len(a) == 1:
	print(-1)
	exit(0)
d = a[n - 1] - a[n - 2]
if d > 0:
	print('UP')
else:
	print('DOWN')


def solve(n, a):
	if n == 1 and a[0] == 15:
		return 'DOWN'
	if n == 1 and a[0] == 0:
		return 'UP'
	if n == 1:
		return -1
	(x, y) = (a[-2], a[-1])
	if (x, y) == (14, 15):
		return 'DOWN'
	if (x, y) == (1, 0):
		return 'UP'
	if x < y:
		return 'UP'
	if x > y:
		return 'DOWN'
n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))


n = int(input())
last = -1

def rev(st):
	if st == 'UP':
		return 'DOWN'
	if st == 'DOWN':
		return 'UP'
	return -1
nums = [int(x) for x in input().split()]
if n == 1 and nums[0] == 0:
	print('UP')
elif n == 1 and nums[0] == 15:
	print('DOWN')
else:
	for i in range(len(nums)):
		if i == len(nums) - 1:
			if nums[i] != 15 and nums[i] != 0:
				print(last)
			else:
				print(rev(last))
			break
		if nums[i] > nums[i + 1]:
			last = 'DOWN'
		else:
			last = 'UP'


import math

def fact(n):
	ans = 1
	for i in range(2, n + 1):
		ans *= i
	return ans

def comb(n, c):
	return fact(n) // (fact(n - c) * c)
n = int(input())
nums = list(map(int, input().split()))
if n == 1:
	if nums[0] == 0:
		print('UP')
	elif nums[0] == 15:
		print('DOWN')
	else:
		print(-1)
elif nums[n - 1] > nums[n - 2] and nums[n - 1] != 15 or nums[n - 1] == 0:
	print('UP')
else:
	print('DOWN')


n = int(input())
d = list(map(int, input().split()))
if n == 1 and abs(7.5 - d[0]) != 7.5:
	print(-1)
elif n == 1 and d[0] == 15:
	print('DOWN')
elif n == 1 and d[0] == 0:
	print('UP')
elif d[-1] > d[-2] and d[-1] != 15 or (d[-1] < d[-2] and d[-1] == 0):
	print('UP')
elif d[-1] < d[-2] and d[-1] != 0 or (d[-1] > d[-2] and d[-1] == 15):
	print('DOWN')


n = int(input())
a = list(map(int, input().split()))
if n is 1:
	if a[0] is 15:
		print('DOWN')
	elif a[0] is 0:
		print('UP')
	else:
		print('-1')
else:
	size = len(a)
	if a[size - 2] < a[size - 1] and a[size - 1] != 15 or a[n - 1] is 0:
		print('UP')
	else:
		print('DOWN')


n = int(input().strip())
ll = list(map(int, input().split()))
if n > 1:
	if ll[-2] < ll[-1]:
		if ll[-1] == 15:
			print('DOWN')
		else:
			print('UP')
	elif ll[-1] == 0:
		print('UP')
	else:
		print('DOWN')
elif ll[-1] == 0:
	print('UP')
elif ll[-1] == 15:
	print('DOWN')
else:
	print(-1)


__author__ = 'Администратор'
n = int(input())
arr = list(map(int, input().split(' ')))
l = arr.__len__()
if l == 1:
	if arr[0] == 0:
		print('UP')
		exit()
	if arr[0] == 15:
		print('DOWN')
		exit()
	print('-1')
	exit()
else:
	if arr[l - 1] > arr[l - 2]:
		if arr[l - 1] != 15:
			print('UP')
			exit()
		else:
			print('DOWN')
			exit()
	if arr[l - 1] < arr[l - 2]:
		if arr[l - 1] != 0:
			print('DOWN')
			exit()
		else:
			print('UP')
			exit()


n = int(input())
a = [int(x) for x in input().split()]
if n < 2:
	if a[0] == 15:
		print('DOWN')
		exit()
	if a[0] == 0:
		print('UP')
		exit()
	else:
		print('-1')
		exit()
if a[-1] == 15:
	d = a[-1] - a[-2]
	if d > 0:
		print('DOWN')
		exit()
	else:
		print('UP')
		exit()
if a[-1] == 15 or a[-1] == 0:
	d = a[-1] - a[-2]
	if d > 0:
		print('DOWN')
		exit()
	else:
		print('UP')
		exit()
else:
	d = a[-1] - a[-2]
	if d > 0:
		print('UP')
	else:
		print('DOWN')