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.

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 ai (0 ≤ ai ≤ 15) — Vitya's records. It's guaranteed that the input data is consistent.

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.

NoteIn 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.

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <iterator>
#include <stack>
#include <queue>
#include <utility>
using namespace std;

#define lli long long int
#define mod 1e9+7
#define f(i,x,n) for(i=x;i<n;i++)
#define vlli vector<lli>
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

int main()
{
	std::ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	if(n==1)
	{
		int b;
		cin>>b;
		if(n==1 && b==0)
			cout<<"UP"<<endl;
		else if(n==1 && b==15) cout<<"DOWN"<<endl;
		else if (n==1) cout<<-1<<endl;
	}
	else
	{
		int a[n];
		int i;
		for(i=0;i<n;i++)
		{
			cin>>a[i];
		}
		if(a[n-1] == 0) cout<<"UP"<<endl;
		else if(a[n-1]==15) cout<<"DOWN"<<endl;
		else if(a[n-1] == 0 && a[n-2] == 1)
			cout<<"UP"<<endl;
		else if(a[n-1]-a[n-2]>0)
			cout<<"UP"<<endl;
		else
			cout<<"DOWN"<<endl;
	}
}

#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
#define mod 1000000007

int main() {
       int n;
       cin>>n;
       int arr[n];
       for(int i=0;i<n;i++)cin>>arr[i];
       int flag=0;
       for(int i=1;i<n;i++){
           if((arr[i]-arr[i-1])==1)flag=1;
           else if((arr[i]-arr[i-1])==-1)flag=2;
       }
       if(n==1 && arr[0]==0)cout<<"UP\n";
       else if(n==1 && arr[0]==15)cout<<"DOWN\n";
       else if(arr[n-1]==15)cout<<"DOWN\n";
       else if(arr[n-1]==0)cout<<"UP\n";
       else if(n==1)cout<<"-1\n";
       else{
           if(flag==1)cout<<"UP\n";
           else if(flag==2)cout<<"DOWN\n";
           else cout<<"-1\n";
       }

}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int N;
    scanf("%d" , &N);
    int ar[N];
        for(int i = 0 ; i < N ; i++)
            {
                cin>>ar[i];
            }

        if(N == 1 && ar[0] == 0)
        {
            cout<<"UP"<<endl;
        }
        else if(N == 1 && ar[0] == 15)
        {
            cout<<"DOWN"<<endl;
        }
       else if ( N == 1)
        {
            cout<<"-1"<<endl;
        }
        else
        {
            if(ar[N-1] > ar[N-2] && ar[N-1] != 15 || ar[N-1] == 0)
            cout<<"UP"<<endl;
            else
            cout<<"DOWN"<<endl;
        }

    return 0;
}

#include <iostream>

using namespace std;
int const N=93;
int a[N];
int main()
{
    int n,i;
    cin>>n;
    for(i=0;i<n;i++){
            cin>>a[i];
    }
    int x=(n-1)-(n-3);

    if(a[n-1]==15)
        cout<<"DOWN";
    else if(a[n-1]==0)
        cout<<"UP";
    else if(a[n-1]==1 && a[n-2]==2)
        cout<<"DOWN";
    else if(a[n-1]==0 && a[n-2]==1)
        cout<<"UP";
    else if(n==1){
        cout<<-1;
    }
    else if(n==2){
        if(a[n-2]<a[n-1])
            cout<<"UP";
        else cout<<"DOWN";
    }
    else {
        int inc=0,dec=0;
        for(i=n-3;i<n-1;i++){
            if(a[i]<a[i+1])
                inc++;
            else if(a[i]>a[i+1])
                dec++;
        }
        if(inc>=x)
            cout<<"UP";
        else if(dec<=x)
            cout<<"DOWN";
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> arr(n);
    for(int i = 0; i < n; ++ i)
    {
        cin >> arr[i];
        if(n == 1)
        {
            if(arr[i] == 15)
            {
                cout << "DOWN" << endl;
                return 0;
            }
            if(arr[i] == 0)
            {
                cout << "UP" << endl;
                return 0;
            }
            cout << -1 << endl;
            return 0;
        }
    }
    if(arr[n - 1] == 0)
    {
        cout << "UP" << endl;
        return 0;
    }
    if(arr[n - 1] > arr[n - 2] && arr[n - 1] != 15)
    {
        cout << "UP" << endl;
    }
    else
    {
        cout << "DOWN" << endl;
    }
    return 0;
}

#include <iostream>
using namespace std;
int main ()
{
	int x;
	cin >> x;
	int A[110];

	string cycle = "UP";

	for (int i = 0; i <= x-1; i++) cin >> A[i];

	if (x == 1 && A[0] != 0 && A[0] != 15) cout << "-1";
	else if (A[x-1] == 0) cout << cycle;
	else if (A[x-1] == 15) cout << "DOWN";
	else
	{

		if (A[x-1] > A[x-2] && A[x-1] < 15) cycle = "UP";
		else {cycle = "DOWN";}

		cout << cycle;
	}

	return 0;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#define ll long long
#define fi(s) for(int i =0;i<s;i++)
#define fj(s) for(int j =0;j<s;j++)
#define all(v) ((v).begin()),((v).end())
using namespace std;
char m[202][202] , sum;
int a[100];
int f,ind;
bool sorted(int ind,int a[]) {
	if (ind == 1)return 0;
	for (int i = 0; i < ind-1; i++) {
		if (a[i] > a[i + 1]) {
			return 0;
		}
	}
	return 1;
}
bool other(int ind, int a[]) {
	if (a[ind - 1] == 0)return 0;
	if (ind == 1)return 0;
	if (a[ind - 2] > a[ind - 1])return 1;
	return 0;
}
bool other1(int ind, int a[]) {
	if (a[ind - 1] == 15)return 0;
	if (ind == 1)return 0;
	if (a[ind - 2] < a[ind - 1])return 1;
	return 0;
}
int main() {
	cin >> ind;
	for (int i = 0; i < ind; i++) {
		cin >> a[i];
	}
	if (ind == 1 && a[ind - 1] == 0) { cout << "UP" << endl; return 0;}
	else if (ind == 1 && a[ind - 1] == 15) {
		cout << "DOWN" << endl;
		return 0;
	}
	 if (other(ind, a) || a[ind-1] == 15) {
		cout << "DOWN" << endl;
	}
	else if (other1(ind, a)|| a[ind-1] == 0) {
		cout << "UP" << endl;
	}
	else cout << -1 << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    int arr[n];
    for (int i = 0; i < n; ++i)
    {
        cin>>arr[i];
    }
    if(arr[n-1] == 0)cout<<"UP"<<'\n';
    else if(arr[n-1] == 15)cout<<"DOWN"<<'\n';
    else if(n==1)cout<<-1<<'\n';
    else if(arr[n-2] < arr[n-1])cout<<"UP"<<'\n';
    else cout<<"DOWN"<<'\n';

    return 0;
}

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <limits>
#include <cmath>
#include <string>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <sstream>
#include <vector>
#include <regex>
#include <iterator>
#include <stack>
#include <unordered_map>
#include <regex>

#define LLI long long int
#define LD long double
#define FOR(x,y,z) for(int x = y; x<z; x++)
#define FORi(x,y) for(int i = x; i<y; i++)
#define FORi2(x,y) for(int i2 = x; i2<y; i2++)
#define FORi3(x,y) for(int i3 = x; i3<y; i3++)
#define FORi4(x,y) for(int i4 = x; i4<y; i4++)
#define xorSwap(x,y) x = x^y; y = x^y; x = x^y

using namespace std;

int main()
{
	std::ios::sync_with_stdio(false);

	int n; cin >> n;
	if (n == 1)
	{
	    int only; cin >> only;
	    cout << ((only==0) ? "UP" :
	        ((only==15)?"DOWN":"-1")
	        );
	    return 0;
	}

	if (n == 0)
	{
	    cout << -1;
	    return -1;
	}

	int last, lastM1;
	FORi(0, n-1)
	{
	    cin >> lastM1;
	}
	cin >> last;
	cout << (((last-lastM1) > 0)^(last==15 || last==0) ? "UP" : "DOWN");
}

/*#include<iostream>
#include<fstream>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<math.h>
#include<cmath>
#include<string>
#include<algorithm>
#include<iomanip>
#include<bitset>
#include<stdio.h>
#include<string.h>
#define lp(i,n) for (int i=0;i<n;i++)
#define ef else if
#define re return
#define ll long long
using namespace std;
int main()
{
	int t,f,n;
	string s;
	char x,y;
	scanf("%d",&t);
	while(t--)
	{
		set<char>se;
		cin>>s;
		n=s.size(),f=0;
		lp(i,n)
			se.insert(s[i]);
		set<char>::iterator it=se.begin();
		lp(i,n)
		{
			if(s[i]==*it)
			{
				while(s[i]==*it&&i<n)
					i++;
				i--,it++;
			}
			else
				x=*it,y=s[i],f=1,i=n;
			if(it==se.end())
				i=n;
		}
		if(f)
		{
			lp(i,n)
				if(s[i]==x)
					s[i]=y;
			   ef(s[i]==y)
				  s[i]=x;
		}
		cout<<s<<endl;
	}
	return 0;
}*/
#include<iostream>
#include<fstream>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<math.h>
#include<cmath>
#include<string>
#include<algorithm>
#include<iomanip>
#include<bitset>
#include<stdio.h>
#include<string.h>
#define lp(i,n) for(int i=0;i<n;i++)
#define re return
#define ef else if
#define V vector
#define ll long long
using namespace std;
int main()
{
	int n,a[100],f=0;
	string s="aaaaa";
	set<char>se;
	char x,y;
	se.insert('a');
	set<char>::iterator it=se.begin();
	cin>>n;
	lp(i,n)
		cin>>a[i];
	lp(i,1000)
	{
		if(s[i]==*it)
			{
				while(s[i]==*it&&i<s.size())
					i++;
				i--,it++;
			}
			else
				x=*it,y=s[i],f=1,i=1000;
			if(it==se.end())
				i=1000;
	}
	if(n==1&&a[0]==0)
		cout<<"UP"<<endl;
	ef(n==1&&a[0]==15)
		cout<<"DOWN"<<endl;
	ef(n==1)
		cout<<-1<<endl;
	else
	{
		if(a[n-1]>a[n-2]&&a[n-1]==15)
			cout<<"DOWN"<<endl;
		ef(a[n-1]>a[n-2])
			cout<<"UP"<<endl;
		ef(a[n-1]<a[n-2]&&a[n-1]==0)
			cout<<"UP"<<endl;
		ef(a[n-1]<a[n-2])
			cout<<"DOWN"<<endl;
	}
	re 0;
}
/*
*/

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<ll> > vvll;

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

int main() {
	ll n,x,i;
	cin>>n;vll v;
	fr(i,0,n)
	{
		cin>>x;
		v.push_back(x);
	}
	if(n==1)
	{
		if(v[n-1]==15)
		{
			cout<<"DOWN";
		}
		else
		{
			if(v[n-1]==0)
			{
				cout<<"UP";
			}
			else
			{
				cout<<"-1";
			}
		}
	}
	else
	{if(v[n-1]==0 )
	{
			cout<<"UP";
	}
	else{	if(v[n-2]<v[n-1] && v[n-1]!=15)
		{
			cout<<"UP";
		}
		else
		{
			cout<<"DOWN";
		}
	}
	}
	return 0;
}

#include <iostream>
using namespace std;
int n,a[400000],i;
int main()
{
	cin>>n;
	for(i=1;i<=n;i++)
		cin>>a[i];
	if(a[n]==15)
		cout<<"DOWN";
	else if(a[n]==0)
		cout<<"UP";
	else if(n==1)
		cout<<-1;
	else if(a[n-1]<a[n])
		cout<<"UP";
	else cout<<"DOWN";
	cin>>n;
	return 0;
}

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <set>
using namespace std;

int main(){
	int n;
	int m;
	cin >> n;
	if(n == 1){
		cin >> m;
		if(m == 15){
			cout << "DOWN" << endl;
			return 0;
		}else if(m == 0){
			cout << "UP" << endl;
			return 0;
		}else{
			cout << -1 << endl;
			return 0;
		}
	}
	int a, b;
	for(int i = 0; i < n-2; i++){
		cin >> a;
	}
	cin >> a;
	cin >> b;
	if(b != 15 &&(b==0 || b - a == 1)){
		cout << "UP" << endl;
		return 0;
	}else{
		cout << "DOWN" << endl;
		return 0;
	}
	return 0;
}

#include <bits/stdc++.h>
//using namespace std;
using namespace std;
int main(){

long long  int t,l,r=0,b,c=0,d,k,i,max;

    cin>>t;

   long long  int a[t];
   for(i=1;i<=t;i++){
      cin>>a[i];
            c++;

}

  //  cout<<t;
//cout<<a[t] <<a[t-1] ;
  // cout<<max;

   if( c==1&&a[t]!=15&&a[t]!=0){
cout<<"-1";
        r=1;}

else if( a[t-1]<a[t]&&r==0&&a[t]!=15||a[t]==0){

cout<<"UP";
}
   // else if(c==1&&a[t]==0){
       // cout<<"-1";
   // }
else {

cout<<"DOWN";
}

}

#include<cstdio>
#include<bits/stdc++.h>
#include<string.h>
int main()
{
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    if(n==1 && a[n-1]==15)
        printf("DOWN");
    else if(n==1 && a[n-1]==0)
        printf("UP");
    else if(n==1)
        printf("-1");
    else if(a[n-1]<a[n-2] && a[n-1]!=0)
        printf("DOWN");
    else if(a[n-1]>a[n-2] && a[n-1]!=15)
        printf("UP");
    else if(a[n-1]>a[n-2] && a[n-1]==15)
        printf("DOWN");
    else if(a[n-1]<a[n-2] && a[n-1]==0)
        printf("UP");
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int d[n];
    for(int i=0;i<n;i++)
        cin>>d[i];
    if(n==1){
        if(d[0]==15)
            cout<<"DOWN";
        else if(d[0]==0)
            cout<<"UP";
        else
            cout<<"-1";
    }
    else{
        if(d[n-2]>d[n-1]){
            if(d[n-2]==1 && d[n-1]==0)
            cout<<"UP";
            else
            cout<<"DOWN";
        }
        else{
            if(d[n-2]==14 && d[n-1]==15)
                cout<<"DOWN";
            else
                cout<<"UP";
        }
    }
}

#include <string>
#include <iostream>
#include <vector>

using namespace std;

int main(){
	int n;
	int max=0;
	int maxInd=0;
	cin>>n;
	int p;
	for(int i = 0 ;i<n;i++){
		cin>>p;
		if(p==0){
			max=0;
		}
		if(p>max){
			max = p;
			maxInd = i;
		}
	}
	if((n ==1&&max!=0&&max!=15)){
		cout<<-1<<endl;
	}else
		if((maxInd==n-1&&max!=15)||max==0){
			cout<<"UP"<<endl;
		}else cout<<"DOWN"<<endl;
    return 0;
}

#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
    int n,c=0;
    scanf("%d",&n);
    int a[n],i;
    a[0]=-1;
    i=1;
    for(int j=1; j<=n; j++)
    {
        if(j==16)
        {
            i=1;
            a[i-1]=0;
        }
        scanf("%d",&a[i]);
        if(n==1&&a[1]<15&&a[1]>0)
        {
            printf("-1\n");
            return 0;
        }
        else  if(a[i]==15)
            c=0;
        else if(a[i]==0)
            c++;
        else  if(a[i]>a[i-1])
        {
            c++;
        }
        else
            c=0;
        i++;
    }
    if(c>0)
        printf("UP\n");
    else
        printf("DOWN\n");
    return 0;
}

#include<cstdio>
using namespace std;
int n,a[110];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&a[i]);
	if(n==1&&a[1]!=15&&a[1]!=0)
	{
		printf("-1");
		return 0;
	}
	if(a[n-1]>a[n]&&a[n]!=0) printf("DOWN");
	else if(a[n-1]>a[n]&&a[n]==0) printf("UP");
	else if(a[n-1]<a[n]&&a[n]!=15) printf("UP");
	else if(a[n-1]<a[n]&&a[n]==15) printf("DOWN");
	else if(a[1]==15) printf("DOWN");
	else if(a[1]==0) printf("UP");
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int size;
    scanf("%d",&size);
    int a2[size];
    for(int i=0; i<size; i++)
    {
        scanf("%d",&a2[i]);
    }
    if(size==1&&a2[size-1]!=15&&a2[size-1]!=0)
    {
        printf("-1");
        return 0;
    }
    else if(size!=1&&a2[size-1]!=0)
    {

            if(a2[size-1]<a2[size-2])
            {
                printf("DOWN");
                return 0;
            }

        if(a2[size-1]>a2[size-2]&&a2[size-1]==15)
        {
            printf("DOWN");
            return 0;
        }
    }
if(size==1&&a2[size-1]==15)
{
    printf("DOWN");
    return 0;
}
    printf("UP");
    return 0;
}

#include <iostream>
#include <fstream>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iomanip>      //setprecision
using namespace std;

int main()
{
//////////////////////////////////////
    #ifndef ONLINE_JUDGE            //
                                    //
         ifstream cin(".in");       //
        // ofstream cout(".out");   //
    #endif                          //
//////////////////////////////////////

    int n;
    int a[100];

    cin >> n;

    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }

    if(a[n] == 15)
    {
        cout << "DOWN";
        return 0;
    }

    if(a[1] == 0 || a[n] == 0)
    {
        cout << "UP";
        return 0;
    }

    if(n == 1)
    {
        cout << -1;
        return 0;
    }

    for(int i = 1; i <= n; i++)
    {
        if(a[n] - a[n - 1] == 1)
        {
            cout << "UP";
            return 0;
        }

        if(a[n] - a[n - 1] == -1)
        {
            cout << "DOWN";
            return 0;
        }
    }

    return 0;
}

#include <iostream>

void main()
{
	int n;
	std::cin >> n;
	int* A = new int[n];
	for (int i = 0; i < n; i++)
		std::cin >> A[i];
	if (n == 1 && A[n-1] == 15)
		std::cout << "DOWN" << std::endl;
	else if (n == 1 && A[n - 1] == 0)
		std::cout << "UP" << std::endl;
	else if(n == 1)
		std::cout << -1 << std::endl;
	else if (((A[n - 2] > A[n - 1]) && A[n - 1] != 0) || A[n - 1] == 15)
		std::cout << "DOWN" << std::endl;
	else if (((A[n - 2] < A[n-1]) && A[n - 1] != 15) || A[n - 1] == 0 ) std::cout << "UP" << std::endl;
}

#include <bits/stdc++.h>
using namespace std;
int main (){
	int n;\
	cin>>n;
	int a[n];
	for (int i=0;i<n;i++)
	cin>>a[i];
	if (n==1&&a[n-1]!=15&&a[n-1]!=0){

	cout<<-1;

	return 0;
	}
	if (a[n-1]==0){
		cout<<"UP";
		return 0;
	}

	if (a[n-2]<a[n-1]&&a[n-1]+1<=15)
	cout<<"UP";
	else cout<<"DOWN";

	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <deque>
#include <functional>
#include <iterator>
#include <vector>
#include <map>
#include <list>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#define PI acos(-1)
#define LL long long
#define MAX 0x3fffffff
#define INF 0x3f3f3f3f
#define mem(a) memset(a,0,sizeof(a))
const int MAX_N = 1e5+10;
const double eps = 1e-8;
const LL mod = 1000000007;
using namespace std;
int a[100];
int main()
{
    int N;
    cin>>N;
    for(int i = 0;i < N;i++)
        scanf("%d",&a[i]);
    if(a[N-1] == 15) cout<<"DOWN";
    else if(a[N-1] == 0) cout<<"UP";
    else if(N == 1) cout<<"-1";
    else
    {
        if(a[N-1] < a[N-2]) cout<<"DOWN";
        else cout<<"UP";
    }
    cout<<endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,a,b;
    cin >> n;
    int c[n];
    for (int i = 0 ; i < n ; i ++){
        cin >> c[i];
    }
    if (n == 1 && c[0] != 15 && c[0] != 0){
        cout << -1;
        return 0;
    }
    else if (n == 1 && c[0] == 15){
        cout << "DOWN";
    }
    else if (n == 1 && c[0] == 0){
        cout << "UP";
    }
    else{
        a = c[n-2];
        b = c[n-1];
        if (b == 0){
            cout << "UP";
        }
        else if (a > b || b == 15){
            cout << "DOWN";
        }
        else{
            cout << "UP";
        }
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
string s[]={"UP","DOWN"};
int main()
{
	int n;
	cin>>n;
	int a[105];
	for(int i=0;i<n;i++)
		cin>>a[i];
	if(a[n-1]==0)
	{
		cout<<s[0];
		return 0;
	}
	if(a[n-1]==15)
	{
		cout<<s[1];
		return 0;
	}
	if(n<=1)
	{
		cout<<-1;
		return 0;
	}
	int t;
	for(int i=1;i<n;i++)
		if(a[i]<a[i-1])
			t=1;
		else
			t=0;
	cout<<s[t];
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main(){
int n;
cin>>n;
int a;
vector<int >v;
for (int i=0;i<n;i++){
    cin>>a;
    v.push_back(a);

}
if(n==1){
    if(v[0]==15) {
        cout<<"DOWN"<<endl;
        return 0;
    }
    if(v[0]==0) cout<<"UP"<<endl;
    else cout<<"-1"<<endl;
}

else{
    if(v[v.size()-1]==15) cout<<"DOWN"<<endl;
    else if(v[v.size()-1]==0) cout<<"UP"<<endl;
    else if((v[v.size()-1]>v[v.size()-2])){
        cout<<"UP"<<endl;
    }
    else if((v[v.size()-1]<v[v.size()-2])){
        cout<<"DOWN"<<endl;
    }

}

return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	int a[n];
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);

	}
	if(n==1&&a[n-1]!=0&&a[n-1]!=15)
		printf("-1");
	else if(a[n-1]==15){
		printf("DOWN");
	}
	else if(a[n-1]==0){
		printf("UP");
	}
	else if(a[n-2]<a[n-1]){
		printf("UP");
	}
	else if(a[n-2]>a[n-1]){
		printf("DOWN");
 	}

}

#include<iostream>
using namespace std;
int main()
{
    int n,i,j,a[100001];
    int count=0,count1=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int diff;
    diff=a[n-1]-a[n-2];
    if(a[n-1]==0)
    {
        cout<<"UP";
        return 0;

    }
    else if(a[n-1]==15)
    {
        cout<<"DOWN";
        return 0;
    }
    else if(n==1)
    {
        cout<<"-1";
        return 0;
    }
    else
    if(diff==1)
    {
        cout<<"UP";
        return 0;

    }
    else if(diff==-1)
    {
        cout<<"DOWN";
        return 0;
    }
}

#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
	int n, k[1000];
	cin >> n;

		for (int i = 1; i <= n; i++)
		{
			cin >> k[i];
		}
		for (int j = n; j >= (n - 1); j--)
		{
			if (n == 1&& k[j]== 15 && k[j] != 0)
			{
				cout << "DOWN" << endl;
				break;
			}
			else if (n == 1 && k[j] != 15 && k[j] != 0)
			{
				cout << "-1" << endl;
				break;
			}
			else if (n == 1 && k[j] == 0)
			{
				cout << "UP" << endl;
				break;
			}

			if (k[j] > k[j - 1]&& k[j] != 15 ||k[j]==0)
			{

				cout << "UP" << endl;
				break;
			}
			else if(k[j] < k[j - 1] || k[j] == 15)
			{
				cout << "DOWN" << endl;
				break;
			}

		}

		return 0;
	}

#include<iostream>

using namespace std;
void main()
{
	int size;
	cin>>size;

	int *arr=new int [size];
	for(int i=0; i<size;++i)
	{
		cin>>arr[i];
	}

	if(size<2 && arr[0]!=15  && arr[0]!=0)
		cout<<-1<<endl;
	else if((size<2 && arr[0]==15 ) ||(size<2 &&  arr[0]==0))
	{
		if(arr[0]==15)
          cout<<"DOWN"<<endl;
		else
			cout<<"UP"<<endl;
	}
	else
	{
		if(arr[size-1]<arr[size-2]&&arr[size-1]!=0)
			cout<<"DOWN"<<endl;
		else
		{
			if(arr[size-1]==15)
				cout<<"DOWN"<<endl;
			else
				cout<<"UP"<<endl;
		}
	}

	delete arr;

}

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int x[n];
    for(int i=0;i<n;i++)
    {
        cin>>x[i];
    }
    if(n==1&&x[n-1]!=15 && x[n-1]!=0)
    {
        cout<<-1;
    }
    else if(x[n-1]==0)
    {
        cout<<"UP";
    }
    else if(x[n-1]==15)
    {
        cout<<"DOWN";
    }
    else if(x[n-2]<x[n-1])
    {
        cout<<"UP";
    }
    else if(x[n-2]>x[n-1])
    {
        cout<<"DOWN";
    }
    else if(n==1)
    {
        cout<<-1;
    }
}

#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include<map>
#include<queue>
#include <functional>
#include<set>
using namespace std;

int main()
{
	int count;
	vector<int>days;
	cin>>count;
	for(int i=0;i<count;i++)
	{
		int x;cin>>x;
		days.push_back(x);
	}
		if(count==1)
	{
		if(days[0]==0)
		    cout<<"UP";
		else if(days[count-1]==15)
		   cout<<"DOWN";
		else
			cout<<-1;
	}
	else
	{
		if(days[count-1]==15)
		{cout<<"DOWN";return 0;}
		if(days[count-1]==0)
		{cout<<"UP";return 0;}
		if(days[count-2]>days[count-1])
		     cout<<"DOWN";
		else
			cout<<"UP";
	}
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[105];
int main()
{
    int n;
    cin >> n;
    for(int i = 1;i <= n;i++)
        scanf("%d",&a[i]);
    if(n == 1)
    {
        if(a[n] == 15)
            printf("DOWN\n");
        else if(a[n] == 0)
            printf("UP\n");
        else
             printf("-1\n");
    }
    else
    {
        if(a[n] == 15)
            printf("DOWN\n");
        else if(a[n] == 0)
            printf("UP\n");
        else
        {
            if(a[n] > a[n-1])
                printf("UP\n");
            else
                printf("DOWN\n");
        }
    }
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n,i,j;
    cin>>n;
    int N[n];
    for(i=0;i<n;i++) cin>>N[i];
    if(n==1){
        if(N[0]==15) cout<<"DOWN"<<endl;
        else if(N[0]==0) cout<<"UP"<<endl;
        else cout<<-1<<endl;
    }
    else{
        j=N[n-1]-N[n-2];
        if(N[n-1]==15) cout<<"DOWN"<<endl;
        else if(N[n-1]==0) cout<<"UP"<<endl;
        else if(j>0) cout<<"UP"<<endl;
        else cout<<"DOWN"<<endl;
    }

    return 0;
}

#include <iostream>
using namespace std;
#define int1 long long
int main()
{
    int1 n;
    cin>>n;
    if(n==1)
    {
        int1 num;
        cin>>num;
        if(num==0)
        cout<<"UP"<<endl;
        else if(num==15)
        cout<<"DOWN"<<endl;
        else
         cout<<"-1"<<endl;
         return 0;
    }
    int1 *a=new int1[n];
    for(int1 i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(a[n-1]==0)
    {
        cout<<"UP"<<endl;
        return 0;
    }
    else if(a[n-1]==15)
    {
        cout<<"DOWN"<<endl;
        return 0;
    }
    else{
    if(a[n-2]>a[n-1])
        cout<<"DOWN"<<endl;
        else
        cout<<"UP"<<endl;}
return 0;
}

#include <iostream>
using namespace std;
int main()
{ int i,j,k,l,n,m,a[10000];
  cin>>n;

  for(i=0;i<n;i++)
  {
  cin>>a[i];
  }

  if(n==1)
   {
    if(a[n-1]==15)
    cout<<"DOWN";

    else if(a[n-1]==0)
    cout<<"UP";
    else
    cout<<-1;
   }
  else
   {

    if((a[n-1]!=15)&&(a[n-1]!=0))
    {
     if(a[n-1]>a[n-2])
     cout<<"UP";
     else
     cout<<"DOWN";
    }
    else
    {
     if(a[n-1]==15)
       cout<<"DOWN";
     else
       cout<<"UP";
    }
    }

return 0;
}

#include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
int main()
{
	int n, arr[92];
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &arr[i]);
	string s = "-1";
	for (int i=0;i<n;i++)
	{
		if (i != (n - 1))
			if ((arr[i]-arr[i+1]==-1 && arr[i+1]!=15) || arr[i+1]==0)
				 s = "UP";
			else if (arr[i] - arr[i + 1]==1 || arr[i+1]==15)
				 s = "DOWN";
	}
	if (n == 1)
		if (arr[0] == 15)
			s = "DOWN";
		else if (arr[0] == 0)
			s = "UP";
	cout << s << "\n";
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    //sort(a,a+n);
    if(a[n-1]==15)
    {
        cout<<"DOWN"<<endl;
    }
    else if(a[n-1]==0)
    {
        cout<<"UP"<<endl;
    }
    else if(a[n-1]>a[n-2])
    {
        cout<<"UP"<<endl;
    }
    else if(2>n)
    {
        cout<<"-1"<<endl;
    }
    else
    {
        cout<<"DOWN"<<endl;
    }

}

#include<bits/stdc++.h>
using namespace std;

int main(void)
{
    int n,a[1000000],q;
    cin>>n;
    if(n==1)
    {
    cin>>q;
    if(q==0) cout<<"UP";
    else if(q==15) cout<<"DOWN";
    else cout<<"-1";
    }
    else
    {
    for(int i=0;i<n;i++)
    cin>>a[i];
    if(a[n-1]==a[n-2])
    cout<<"-1";
    else if(a[n-1]==0) cout<<"UP";
    else if(a[n-1]==15) cout<<"DOWN";
    else if(a[n-1]>a[n-2])cout<<"UP";
    else cout<<"DOWN";
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){

	int a;

	cin >> a;

	int arr[a+1];
	for(int i=0; i<a; i++){

		cin >> arr[i];
	}

	if(arr[a-1]==15)
		cout << "DOWN" << endl;
	else if(arr[a-1]==0)
		cout << "UP" << endl;
	else if(a==1)
		cout << -1 << endl;
	else{
		if(arr[a-1]>arr[a-2])
			cout << "UP" << endl;
		else
			cout << "DOWN" << endl;
	}
	return 0;
}

#include<iostream>
using namespace std;
int main()
{
    int m,n=0,i=0;
    cin>>m;

    int a[m];
    for(;i<m;i++){
        cin>>a[i];
        if(m<2) {
            if(a[i] ==0){ cout<<"UP"<<endl; return 0;}
            if(a[i]==15) cout<<"DOWN"<<endl;
            if(a[i]<15)cout<<-1<<endl;
            return 0;
        }
        if(a[i]>a[i-1]) n=1;
        if(a[i]<a[i-1]) n=0;
        if(a[m-1]==15) n=0;
    }
    if(a[m-1]==0) {cout<<"UP"<<endl; return 0;}
    if(n==1) cout<<"UP"<<endl;
    if(n==0) cout<<"DOWN"<<endl;
    return 0;
}

#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;

#define N 50001
queue<int> que;

int main(){
	int n;
	while (cin >> n)
	{
		int a[100];
		for (int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		if (n==1)
		{
			if (a[n-1]!=15&&a[n-1]!=0)
			{
				cout<<"-1"<<endl;
			}else
			{
				if (a[n-1]==0)
				{
					cout<<"UP"<<endl;
				}else{
					cout<<"DOWN"<<endl;}
			}

		}else
		{
			if (a[n-1]-a[n-2]>0&&a[n-1]!=15&&a[n-1]!=0)
			{
				cout<<"UP"<<endl;
			}else
			{
				if (a[n-1]==0)
				{
					cout<<"UP"<<endl;
				}else{
					cout<<"DOWN"<<endl;}
			}
		}

	}
	return 0;
}

#include <iostream>
using namespace std;

int a[93];

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	if (a[n] == 0) {
		cout << "UP" << endl;
	}
	else if (a[n] == 15) {
		cout << "DOWN" << endl;
	}
	else if (n == 1) {
		cout << -1 << endl;
	}
	else {
		if (a[n] > a[n - 1]) {
			cout << "UP" << endl;
		}
		else if (a[n] < a[n - 1]) {
			cout << "DOWN" << endl;
		}
	}
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int a[100],i,n,flag;
    while(cin>>n)
    {
        memset(a,0,sizeof(a));
        flag=0;
        for(i=1; i<=n; i++)
        {
            cin>>a[i];
        }
        if(n==1&&a[n]>0&&a[n]<15)
            cout<<"-1"<<endl;
        else if(n==1&&a[n]==0)
            cout<<"UP"<<endl;
        else if(n==1&&a[n]==15)
            cout<<"DOWN"<<endl;
        else
        {
            if(a[n]>a[n-1]&&a[n]<15||(a[n]<a[n-1]&&a[n]==0))
                cout<<"UP"<<endl;
            else if(a[n]<a[n-1]||a[n]==15)
                cout<<"DOWN"<<endl;
        }
    }
    return 0;
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

#include <bits/stdc++.h>
#include <stdio.h>

#define INF (int)10e6
#define eps 10e-6
#define mp make_pair
#define pub push_back
#define pob pop_back
#define all(t) t.begin(),t.end()
#define LL long long
#define MOD 1000000007
#define fr(i, a, b) for(int i = a ; i <= b ; i++)
#define frev(i, b, a) for(int i = b ; i >= a ; i--)
#define rt return

using namespace std;

//ifstream fin ("input.txt");
//ofstream fout ("output.txt");
int n, x, y = -1;
bool up;
int main(int argc, char** argv) {
    std::ios::sync_with_stdio(false);
    cin.tie(NULL);
    //    freopen("input.in","r",stdin);
    //    freopen("output.out","w",stdout);
    cin >> n;
    fr(i, 1, n-1)
    {
        cin >> x;
    }
    cin >> y;
    if(y == 0)
    {
        puts("UP");
    }
    else if(y == 15)
    {
        puts("DOWN");
    }
    else if(x > y)
    {
        puts("DOWN");
    }
    else if(y > x && n != 1)
    {
        puts("UP");
    }
    else
    {
        puts("-1");
    }
    return 0;
}

#include <iostream>
using namespace std;
int main()
{
	int n, a[93];
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	if (a[n - 1] == 15)
	{
		cout << "DOWN" << endl;
	}
	else if (n == 1 && a[n-1]!=0)
		cout << -1 << endl;
	else if(a[n-1] == 0)
		cout << "UP" << endl;
	else if (a[n - 1] < a[n - 2])
		cout << "DOWN" << endl;
	else cout << "UP" << endl;
	return 0;
}

#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <algorithm>
#define LL long long
using namespace std;
int a[105];
int b[100] = { 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 };
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
	}

	if (n == 1)
	{
		if (a[1] == 0)
			printf("UP");
		else if(a[1]==15)
			printf("DOWN");
		else
		printf("-1");
	}
	else
	{
		for (int i = 0; i < 100; i++)
		{
			if (a[n - 1] == b[i] && a[n] == b[i + 1])
			{
				if (b[i + 2] > b[i + 1])
					printf("UP");
				else
					printf("DOWN");
				break;
			}
		}
	}
	return 0; }

#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef	long long ll;
typedef unsigned long long ull;
#define all(v) ((v).begin()),((v).end())
#define sz(v) ((int)((v).size()))
#define PI(n) ((double)acos(n))
#define pw2(n) (1LL<<(n))
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d%d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define clr(memo,n) memset(memo, n, sizeof(memo))
int dx8[8] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy8[8] = { 0, 0, 1, -1, 1, -1, 1, -1 };
void file()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#else
	// online submission
#endif
}
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}
int main()
{
	file();
	int a[1000];
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	if (a[n-1] == 15)
		cout << "DOWN" << endl;
	else if (a[n-1] == 0)
		cout << "UP" << endl;
	else if (n == 1)
		cout << -1 << endl;
	else {
		int a1 = a[n - 1];
		int b = a[n - 2];
		 if (a1 > b)
			cout << "UP" << endl;
		else cout << "DOWN" << endl;
	}

}

#include <iostream>
using namespace std;

int n,a[100100],x,i;
int main(){
    cin>>n;
    if(n==1){
        cin>>x;
        if(x==15){
            cout<<"DOWN";
            return 0;
        }
        else if(x==0){
            cout<<"UP";
            return 0;
        }
        else{
            cout<<-1;
            return 0;
        }

		}

    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    if(a[n-1]==0 && a[n-2]==1){
    	cout<<"UP";
	}
    else if(a[n-1]==15 && a[n-2]==14){
        cout<<"DOWN";
         return 0;
    }

    else if(a[n-1]>a[n-2]){
        cout<<"UP";
        return 0;
    }
     else {
    	cout<<"DOWN";
	}
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,h[233];

int main()
{
	scanf("%d",&n);
	for(int i = 1;i <= n;i ++) scanf("%d",&h[i]);
	if(n == 1)
	{
		if(h[n] == 0) puts("UP");
		else if(h[n] == 15) puts("DOWN");
		else puts("-1");
	}
	else
	{
		if(h[n] > h[n-1])
		{
			if(h[n] == 15) puts("DOWN");
			else puts("UP");
		}
		else if(h[n] < h[n-1])
		{
			if(h[n] == 0) puts("UP");
			else puts("DOWN");
		}
	}
	return 0;
}

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<vector>
#define yes cout << "YES" << endl
#define no  cout << "NO" << endl
#define ntest int t; cin >> t
#define fori(e) for (int i = 0; i < e; i++)
#define forj(e) for (int j = 0; j < e; j++)
#define forn(s,e) for (int i = s; i < e; i++)
using namespace std;

int main()
{
	int n, arr[95];
	cin >> n;
	fori(n)
		cin >> arr[i];

	if (arr[n - 1] == 0)
		cout << "UP" << endl;
	else if (arr[n - 1] == 15)
		cout << "DOWN" << endl;
	else if (n == 1)
		cout << "-1" << endl;
	else if (arr[n - 1] > arr[n - 2])
		cout << "UP" << endl;
	else if (arr[n - 1] < arr[n - 2])
		cout << "DOWN" << endl;

	return 0;
}

#include <iostream>

using namespace std;

int main()
{
   int x;
   string res;
   cin>>x;
   int y[x]={};

   for(int i=0;i<x;i++)
   {
       cin>>y[i];
   }
    if (y[x-1]==15){cout<<"DOWN";return 0;}
    if (y[x-1]==0){cout<<"UP";return 0;}
    if (x==1){cout<<"-1"; return 0;}
   for(int i=0;i<x-1;i++)
   {
       if(y[i]<y[i+1]){res= "UP";}
       else{res="DOWN";}
   }cout<<res;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll n,a[107],i,c=1;
cin>>n;
set<ll> s;
for(i=1;i<=n;i++) {cin>>a[i];s.insert(a[i]);}
if(s.size()==1&&a[1]!=15&&a[1]!=0) cout<<-1;
else if(n==1&&a[1]==0) cout<<"UP";
else if(n==1&&a[1]==15) cout<<"DOWN";
else{
    if((a[n]==15||(a[n-1]>=a[n]))&&a[n]!=0) cout<<"DOWN";
    else cout<<"UP";
}
}

# include <bits/stdc++.h>
using namespace std;

int main()
{
	int n,d=0,v=0;
	cin>>n;
	int a[n];
	bool flag =0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	  	  if(n==1&&a[0]!=15&&a[0]!=0)cout<<"-1";
		else if(a[n-1]==15)cout<<"DOWN";
			else if(a[n-1]==0)cout<<"UP";
		else if(a[n-1]<a[n-2]&&a[n-1]!=0){
		cout<<"DOWN";
		}

		else cout<<"UP";
	}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a=-1,b,t;
    cin>>n;
    while(n--)b=a,cin>>a;
    if(a==0)cout<<"UP",exit(0);
    if(a==15)cout<<"DOWN",exit(0);
    if(!~b)cout<<b,exit(0);
    cout<<(a>b?"UP":"DOWN");
    return 0;
}

 #include <bits/stdc++.h>
using namespace std;

int a[100];
int main()
{
    int n;
    while(cin >> n){
        int ok = 0;
        for(int i = 1;i <= n;++ i){
            cin>>a[i];
            if(a[i] == 15)
                ok = i;
        }
        if(n > 1){
            if(ok){
                if((n-ok) >= 0 && (n-ok) <= 14)
                    cout<<"DOWN"<<endl;
                else
                    cout<<"UP"<<endl;
            }
            else{
                if(a[n] > 0 && a[n] < a[n-1])
                    cout<<"DOWN"<<endl;
                else
                    cout<<"UP"<<endl;
            }
        }
        if(n == 1){ if(a[1]==0){cout<<"UP"<<endl;continue;}
            if(a[1] == 15){
                cout<<"DOWN"<<endl;
                continue;
            }
            cout<<-1<<endl;
        }
    }
    return 0;
}

#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;
typedef signed long long sll;
typedef unsigned long long ull;
#define all(s) ((s).begin()),((s).end())
#define rall(s) ((s).rbegin()),((s).rend())
using namespace std;

void Yuko_Kurama()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
}
int main()
{
    Yuko_Kurama();

    int n;
    while(cin>>n)
    {
        vector<int> v(n);
        for(int i=0;i<n;i++) cin>>v[i];
        string ans="-1";
        if(n==1 && v[n-1]!=15 && v[n-1]!=0) ;
        else if(!v[n-1] || (v[n-1]!=15 && v[n-2]<v[n-1]) ) ans="UP";
        else if(v[n-2]>v[n-1] || v[n-1]==15 ) ans="DOWN";

        cout<<ans<<endl;
    }

    return 0;
}

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <limits>
#include <cmath>
#include <cstdlib>
#include <string.h>
#include <ctime>

using namespace std;

#define VI vector<int>
#define VVI vector<VI >
#define VB vector<bool>
#define VVB vector<VB >
#define VS vector<string>
#define PII pair<int, int>
#define VPII vector<pair<int, int> >
#define REP(var, startFrom, endTo) for(int var = startFrom; var < (int)endTo; ++var)

inline const int MAX(int a, int b) { return ((a) > (b) ? (a) : (b)); }
inline const int MIN(int a, int b) { return ((a) > (b) ? (b) : (a)); }
inline const int ABS(int a) { return (((a) > 0) ? (a) : (-(a))); }

int n;

string solve(const VI& A)
{
	if (A[n - 1] == 15)
		return "DOWN";
	if (A[n - 1] == 0)
		return "UP";
	if (A.size() == 1)
		return "-1";

	return (A[n - 1] - A[n - 2] > 0) ? "UP" : "DOWN";
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
	cin >> n;

	VI A = VI(n);
	for (int i = 0; i < n; ++i)
		cin >> A[i];

	cout << solve(A) << endl;

	return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[93];
    for(int i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    if(n==1&&a[n]!=15&&a[n]!=0)
        cout<<-1<<endl;
    if(a[n]==15)
    {
        cout<<"DOWN"<<endl;
    }
    if(a[n]==0)
    {
        cout<<"UP"<<endl;
    }
    else
    {
        if(a[n]-a[n-1]==1&&a[n]!=15)
        {
            cout<<"UP"<<endl;
        }
         if(a[n]-a[n-1]==-1)
        {
            cout<<"DOWN"<<endl;
        }

    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main(){
int n,i,j;

cin>>n;

int a[n];

for(i=0;i<n;i++)
    {
    cin>>a[i];
    }

    if(a[n-1]==15)
    {
        cout<<"DOWN"<<endl;
    }
    else if(a[n-1]==0)
    {
        cout<<"UP"<<endl;
    }
    else if(n==1)
    {
    cout<<"-1"<<endl;
    }
    else if(a[n-1]>a[n-2])
    {
        cout<<"UP"<<endl;
    }
    else if(a[n-1]<a[n-2])
        cout<<"DOWN"<<endl;

return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,a,b;
int main()
{
	cin>>n;
	for(int i=1;i<n;i++)  cin>>a;
	cin>>b;
	cout<<(b==15?"DOWN":(b==0?"UP":(n==1?"-1":(a<b?"UP":"DOWN"))));
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,val1,val2;
	cin>>n;
	int a[n];
	for(i=0;i<n;i++)
		cin>>a[i];
	if(a[n-1]==15)
	{
		cout<<"DOWN";
		exit(0);
	}
	if(a[n-1]==0)
	{
		cout<<"UP";
		exit(0);
	}
	if(n==1)
	{
		cout<<"-1";
		exit(0);
	}
	val1=a[n-1];
	val2=a[n-2];
	if(val2>val1)
		cout<<"DOWN";
	else
		cout<<"UP";
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define i64 long long
#define u32 unsigned int
#define u64 unsigned long long

#define Neg(v) memset((v), -1, sizeof(v))
#define Zero(v) memset((v), 0, sizeof(v))

#define ff first
#define ss second
#define sqr(x) ((x)*(x))
#define INF LONG_LONG_MAX
#define PI 2*acos(0)
#define pb push_back

#define WHITE 0
#define GREY  1
#define BLACK  2
const double eps = 1e-9;
//int r[]={1,0,-1,0};int c[]={0,1,0,-1}; ///4 Direction
//int r[]={1,1,0,-1,-1,-1,0,1};int c[]={0,1,1,1,0,-1,-1,-1};///8 direction
//int r[]={2,1,-1,-2,-2,-1,1,2};int c[]={1,2,2,1,-1,-2,-2,-1};///Knight Direction
//int r[]={2,1,-1,-2,-1,1};int c[]={0,1,1,0,-1,-1}; ///Hexagonal Direction

/*****
STL OPERATIONS:

deque
push_back
Add element at the end
push_front
Insert element at beginning
pop_back
Delete last element
pop_front
Delete first element

******/

int main()
{
    ///I_LOVE_YOU_TANYA_ROMANOVA <3
    //freopen("F:/in.txt","r",stdin);
    //freopen("F:/out.txt","w",stdout);

    int num1,temp;

    vector <int> v1;

    cin>>num1;

    for( int A = 1; A <= num1 ; A++ )
    {
        cin>>temp;
        v1.pb(temp);
    }
    if( v1[v1.size()-1] == 15)
    {
        v1.pb(14);
    }
    else if( v1[v1.size()-1] == 0 )
    {
        v1.pb(1);
    }
    if( v1.size() == 1  )
    {

        cout<<"-1\n";
    }
    else
    {
        if( v1[v1.size()-1]== 0  )
        {
            cout<<"UP\n";
        }
        else if( v1[v1.size()-1] > v1[v1.size()-2])
        cout<<"UP\n";
        else
            cout<<"DOWN\n";
    }

}

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int d[n];
    for(int i=0;i<n;i++)
        cin>>d[i];
    if(n==1){
        if(d[0]==15)
            cout<<"DOWN";
        else if(d[0]==0)
            cout<<"UP";
        else
            cout<<"-1";
    }
    else{
        if(d[n-2]>d[n-1]){
            if(d[n-2]==1 && d[n-1]==0)
            cout<<"UP";
            else
            cout<<"DOWN";
        }
        else{
            if(d[n-2]==14 && d[n-1]==15)
                cout<<"DOWN";
            else
                cout<<"UP";
        }
    }
}

#include<bits/stdc++.h>
using namespace std;
int a[93];
int main(){
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	if(a[n-1]==15){
		cout<<"DOWN";
		return 0;
	}
	if(n==1&&a[0]!=0){
		cout<<-1;
		return 0;
	}
	else if(a[n-1]>a[n-2]||(a[0]==0&&n==1)||a[n-1]==0){
		cout<<"UP";
	}
	else {
		cout<<"DOWN";
	}
}

#include <iostream>
using namespace std;
int main() {
	int n;
	bool increasing = true;
	cin >> n;
	int days[100];
	for (int i = 0; i < n; i++) {
		cin >> days[i];
	}
	if (n == 1) {
		if (days[n - 1] == 15) {
			cout << "DOWN";
			return 0;
		}
		else if (days[n - 1] == 0) {
			cout << "UP";
			return 0;
		}
		else if (n > 1) {
			if (days[n - 1] > days[n - 2] && days[n - 1] != 15) {
				cout << "UP";
				return 0;
			}
			else {
				cout << "DOWN";
				return 0;
			}
		}
		else if (n == 1) {
			if (days[n - 1] != 15 && days[n - 1] != 0) {
				cout << -1;
				return 0;

			}
		}
	}
	if (n > 1) {
		if (days[n - 1] < days[n - 2]) {
			increasing = false;
		}
		else
		{
			increasing = true;
		}

		if (days[n - 1] > days[n - 2] && days[n - 1] != 15) {
			cout << "UP";
			return 0;
		}
		else if (days[n - 1] == 0) {
			cout << "UP";
			return 0;
		}

		else {
			cout << "DOWN";
			return 0;
		}

	}

	if (increasing == false) cout << "DOWN";
	else cout << "UP";
	return 0;

}

#include <iostream>
#include<cmath>
#include<string>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{
    int n,arr[93];
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];

    }
    if(n==1&&(arr[0]!=15&&arr[0]!=0))
    {
        cout<<-1<<endl;
        return 0;
    }
    if(arr[n-1]==0)
    cout<<"UP"<<endl;
    else if(arr[n-1]==15)
    cout<<"DOWN"<<endl;
    else
    {
        if((arr[n-1]-arr[n-2])>0)
        {
        cout<<"UP"<<endl;
        }
        else
        cout<<"DOWN"<<endl;
    }
    return 0;
}

#include<bits/stdc++.h>
#define mn 1111111
using namespace std;
int n,a[100];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    if(n==1)
    {
    	if(a[1]==0) {cout<<"UP\n";return 0;}
    	if(a[1]==15) {cout<<"DOWN\n";return 0;}
    	cout<<"-1\n";return 0;
	}
	else if(a[n]>a[n-1])
	{
		if(a[n]==15) {cout<<"DOWN\n";return 0;}
		cout<<"UP\n";return 0;
	}
	else
	{
		if(a[n]==0) {cout<<"UP\n";return 0;}
		cout<<"DOWN\n";return 0;
	}
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
	int n, days[100];
	cin>>n;
	for(int i=0; i<n; i++)
		cin>>days[i];
	if(n==1 && days[0]!=0 && days[0]!=15)
		cout<<-1;
	else if(n==1 && days[0]==0)
		cout<<"UP";
	else if(n==1 && days[0]==15)
		cout<<"DOWN";
	else
	{
		if(days[n-1]==0 )
			cout<<"UP";
		if(days[n-2]>days[n-1] && days[n-1]!=0)
			cout<<"DOWN";
		if(days[n-2]<days[n-1] && days[n-1]!=15)
			cout<<"UP";
		if(days[n-1]==15 )
			cout<<"DOWN";
	}
	return 0;
}

#include <stdio.h>
int main() {
    int n, arr[105];
    scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%d", &arr[i]);
    }
    //printf("%d %d\n", n-2, n-1);
    //printf("%d %d\n", arr[n-2], arr[n-1]);
    if (n == 1 and arr[n-1] > 0 and arr[n-1] < 15){
        printf("-1");
    } else if(n == 1 and arr[n-1] == 0){
        printf("UP");
    } else if (arr[n-2] < arr[n-1] and arr[n-1] < 15){
        printf("UP");
    } else if (arr[n-2] < arr[n-1] and arr[n-1] == 15) {
        printf("DOWN");
    } else if (arr[n-2] > arr[n-1] and arr[n-1] > 0) {
        printf("DOWN");
    } else if (arr[n-2] > arr[n-1] and arr[n-1] == 0) {
        printf("UP");
    } else if (n == 1 and arr[n-1] == 15){
        printf("DOWN");
    }
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

const int maxi = 1007;
int ara[maxi];

int main()
{
    int n;scanf("%d",&n);
    for(int i = 1;i <= n; i++) scanf("%d", &ara[i]);
    if(ara[n] == 0) return puts("UP");
    if(ara[n] == 15) return puts("DOWN");
    if(n == 1) return puts("-1");
    if(ara[n - 1] < ara[n]) return puts("UP");
    if(ara[n - 1] > ara[n]) return puts("DOWN");
}

#include<cstdio>
using namespace std;
int main()
{
    int n,change[2784273];
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&change[i]);
    if(change[n-1]==0)return !printf("UP");
    if(change[n-1]==15)return !printf("DOWN");
    if(n==1)return !printf("-1");
    if(change[n-1]>change[n-2])return !printf("UP");
    if(change[n-1]<change[n-2])return !printf("DOWN");
    return 0;
}

#include <iostream>
using namespace std;
int main() {
	int a;
		cin >> a;
		int *p = new int[a];
		for (int i = 0; i < a; i++)cin >> p[i];
		a = a - 1;
		if (a == 0
			&& p[0] != 15 && p[0] != 0)cout << -1;
		else if (p[a - 1] < p[a] && p[a] != 15||p[a]==0)cout << "UP";
		else cout << "DOWN";
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n+1];
for(int i=0;i<n;i++)
cin>>a[i];
  if(a[n-1]==0)
  cout<<"UP";
  else
  if(a[n-1]==15)
  cout<<"DOWN";
  else
  if(n==1)
  cout<<"-1";
  else
  if(a[n-1]>a[n-2])
  cout<<"UP";
  else
  cout<<"DOWN";
  // not same

}

#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define str string
#define fo freopen
#define ff first
#define ss second
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii >
#define iii pair<int, ii >
#define pb push_back
#define pf push_front
#define all(a) (a).begin(), (a).end()
#define mp make_pair
#define fto(i, l, r) for (int i = l; i <= r; ++i)
#define fdto(i, r, l) for (int i = r; i >= l; --i)
#define fto1(i, l, r) for (int i = l; i < r; ++i)
#define fdto1(i, r, l) for (int i = r; i > l; --i)
#define sci(a) scanf("%d", &a)
#define scii(a, b) scanf("%d %d", &a, &b)
#define sciii(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define bug(a) cout << #a << "=" << a << endl;
#define bug2(a, b) cout << #a << "=" << a << " " << #b << "=" << b << endl;
#define bug3(a, b, c) cout << #a << "=" << a << " " << #b << "=" << b << " " << #c << "=" << c << endl;
#define oo 1e9+7
#define OO 1e18+7
#define maxn 2005
#define name "a."

int n;

int main() {
    #ifndef ONLINE_JUDGE
    fo(name"inp", "r", stdin);
    fo(name"out", "w", stdout);
    #endif // ONLINE_JUDGE
    sci(n);
    int s1;
    sci(s1);
    int h = 0;
    if (n == 1) {if (s1 != 15 && s1 != 0) puts("-1"); else if (s1 == 15) puts("DOWN"); else puts("UP"); return 0;}
    fto1(i, 1, n) {
        int s2;
        sci(s2);
        h = s2 - s1;
        if (h == -14) h = 1;
        if (s2 == 15) h = -1;
        if (s2 == 0) h = 1;
        s1 = s2;
    }
    if (h > 0) puts("UP"); else puts("DOWN");
    return 0;
}

#include <cstdio>

int v[93];
int main()
{
    int n,i;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        scanf("%d",&v[i]);
    if(n==1 && (v[n]!=15 && v[n]!=0))
    {
        printf("-1");
        return 0;
    }
    else if(n==1 && v[n]==15)
    {
        printf("DOWN");
        return 0;
    }
    else if(n==1 && v[n]==0)
    {
        printf("UP");
        return 0;
    }
    if(v[n]==0) {printf("UP");return 0;}

    if(v[n-1]<v[n]&& v[n]!=15) printf("UP");
    else printf("DOWN");
    return 0;
}

//   ALLAH IS THE ALMIGHTY   //
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FOR(i,n)for(int i=0;i<(int)n;i++)
typedef long long l;
const int N=5e6+5;
void solve(){
  int n,tt(0),cnt(0);
  cin>>n;
  int ar[n];
  FOR(i,n)cin>>ar[i];
  if(n==1){
    if(ar[n-1]==15)cout<<"DOWN\n";
    else if(ar[n-1]==0)cout<<"UP\n";
    else cout<<-1<<endl;
  }else if(ar[n-1]==15)cout<<"DOWN\n";
  else if(ar[n-1]==0)cout<<"UP\n";
  else if(ar[n-2]>ar[n-1])cout<<"DOWN\n";
  else if(ar[n-2]<ar[n-1])cout<<"UP\n";
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);cout.tie(0);
  //int t;
  //cin>>t;
  //while(t--)//cout<<solve()<<endl;
      solve();
return 0;
}
//           SOLVED!            //

#include <bits/stdc++.h>
using namespace std;

#define FREP(i,a,b) for(int i=a;i<b;i++)
#define REP(i,n) FREP(i,0,n)
#define ll long long
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

void g_o_a_l()
{
	ll n;
	cin >> n ;
	ll a[n];
	REP(i, n)
	cin >> a[i];
	if (n == 1 && a[0] != 0 && a[0] != 15)
	{
		cout << "-1";
		return;
	}
	if (a[0] == 0 && n == 1)
		cout << "UP";
	else if (a[0] == 15 && n == 1)
		cout << "DOWN";
	else if (a[n - 1] < a[n - 2])
	{
		if (a[n - 1] == 0)
			cout << "UP";
		else
			cout << "DOWN";
	}
	else if (a[n - 1] > a[n - 2])
	{
		if (a[n - 1] == 15)
			cout << "DOWN";
		else
			cout << "UP";
	}
	else
		cout << "-1";
}

int main()
{
	FASTIO;

	int t = 1;
	// cin >> t;
	while (t--)
	{
		g_o_a_l();
	}

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

const int maxn=111;
int a[maxn];
int main() {
    int n; scanf("%d",&n);
    for(int i=0;i<n;++i)scanf("%d",a+i);
    if(a[n-1]==0){
        printf("UP\n");
    }else if(a[n-1]==15){
        printf("DOWN\n");
    }else{
        if(n==1){
            printf("-1");
        }else{
            if(a[n-2]<a[n-1])printf("UP\n");
            else printf("DOWN\n");
        }
    }
    return 0;
}

#include<iostream>
#include<vector>
using namespace std;
int main(){
    int no,moon;
    vector<int> v;
    cin>>no;
    for(int i=0;i<no;i++){
        cin>>moon;
        v.push_back(moon);
    }
    if(no==1){
        if(v[0]==15){
            cout<<"DOWN";
        }
        else if(v[0]==0){
            cout<<"UP";
        }
        else{
            cout<<"-1";
        }
    }
    else if(v[no-1]==15){
        cout<<"DOWN";
    }
    else if(v[no-1]==0){
        cout<<"UP";
    }
    else if(v[no-1]>v[no-2]){
        cout<<"UP";
    }
    else{
        cout<<"DOWN";
    }

}

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
    long long int a;
    cin>>a;
    string s;
    int n[a];
    for(int i=0;i<a;i++)
    {
        cin>>n[i];
    }
    if(a==1)
    {
        cout<<-1;
    }
        else if(n[a-2]<n[a-1])
        {
            cout<<"UP";
        }
        else if(n[a-2]>n[a-1] || n[a-1]==15)
        {
            cout<<"DOWN";
        }
}

#include <iostream>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string>
#include <vector>
#include <deque>
#include <sstream>
#include<utility>
#include <stdio.h>
#include <conio.h>
using namespace std;
int main()
{
int n,arr[100],co=0; cin >>n;
for(int i=1; i<=n; i++){
    cin >> arr[i];
}
if(n==1){cout << "-1" << "\n"; return 0;}
for(int i=1; i<=n; i++){
   if( arr[n]==15){
    cout << "DOWN" << "\n";
    return 0;
   }
    if(arr[n]==1){
        cout << "UP" << "\n";
        return 0;
    }
    if(arr[n] < arr[n-1]){cout <<"DOWN"<<"\n";break;}
    if(arr[n] > arr[n-1]){cout <<"UP"<<"\n"; break;}

}

   return 0;
}

#include<iostream>
#define max 2000
using namespace std;

int main()
{
    int n,a[max];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    if(n==1&&a[n]!=15&&a[n]!=0)
    {
        cout<<"-1";
    }
    else
    {
        if(a[n]==15)
        {
            cout<<"DOWN"<<endl;
        }
        else if(a[n]==0)
        {
            cout<<"UP"<<endl;
        }
        else
        {
            if(a[n]-a[n-1]==1&&a[n]!=15)
            {
                cout<<"UP"<<endl;
            }
            if(a[n]-a[n-1]==-1)
            {
                cout<<"DOWN"<<endl;
            }
        }
    }
    return 0;
}

#include<bits/stdc++.h>
#include<iostream>
#include<list>
#include<vector>
#include<climits>
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<int>::iterator vi_i;
const int MAX=5e5+5;

int main()
{
    int n,a=0;
    int i;
    cin>>n;
    int lol[n+1];
    for(i=1;i<=n;i++)
    {
        cin>>lol[i];
    }
    if(n>1)
    {
        for(i=1;i<=n-1;i++)
        {
            a=lol[i+1]-lol[i];
        }
    }
    if(a==1 && lol[n]==15){cout<<"DOWN"<<endl;return 0;}
    if(a==1)cout<<"UP"<<endl;
    else if(a==-1)cout<<"DOWN"<<endl;
    else cout<<"-1"<<endl;

}

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n;
    int a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    if(a[n]==0)
        cout<<"UP";
    else if(a[n]==15)
        cout<<"DOWN";
    else if(n==1)
        cout<<"-1";
    else
    {
        if(a[n-1]<a[n])
            cout<<"UP";
        else
            cout<<"DOWN";
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a[92];
int main(){
	ios::sync_with_stdio(false);
	long long int n,dw=0,up=0;
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>a[i];
	}
	for(int i=0;i<n;++i){
	       if(n==1){
			cout<<-1;
			return 0;
		}
		if(a[i]>a[i+1]){
		dw++;
		}
		else{
		up++;
		}
		}
		for(int i=0;i<n;++i){
			if(dw>up){
		cout<<"DOWN";
		return 0;
			}
			else{
				cout<<"UP";
				return 0;
			}
		}
	}

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
	int x,a;
	cin >> x;
	vector<int> mas;
	for(int i=0;i<x;i++)
	{
		cin >> a;
		mas.push_back(a);
	}
	if (x < 2)
	{
		cout << "-1";
	}
	else if (mas[x - 1] == 15)
	{
		cout << "DOWN";
	}
	else if (mas[x-1] > mas[x - 2])
	{
		cout << "UP";
	}
	else
	{
		cout << "DOWN";
	}
}

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("popcorn.in","r",stdin);
    int n;cin>>n;
    vector<int>v(n);
    bool b=0,c=1;
    for(int i=0;i<n;i++)cin>>v[i];
    if((v[n-2]>v[n-1])&&(v[n-1]!=1))b=1;
    if(b&&n!=1)cout<<"DOWN";
    else if(!b&&n!=1) cout<<"UP";
    else cout<<-1;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int r[n];
for (int i = 0; i < n; i++)
cin >> r[i];
if (n == 1) {cout << -1; return 0;}
int a = r[n - 1], b = r[n - 2];
if (a < b && a == 1) cout << "UP";
else if (a < b) cout << "DOWN";
else if (a > b && a == 15) cout << "DOWN";
else cout << "UP";
return 0;
}

# include <bits/stdc++.h>

using namespace std;

int n, m, k, a[100];

int main() {
    ios_base::sync_with_stdio(false);
    cin >> n;
    for(int i = 1;i <= n;i++)
        cin >> a[i];
    if(n == 1)
        cout << -1;
    else
    {
        if(a[n] < a[n - 1])
            cout << "DOWN";
        if(a[n] > a[n  - 1])
            cout << "UP";
    }
}

#include <bits/stdc++.h>
using namespace std;

int main() {
	string ans;
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;++i)
	{
		cin>>a[i];
	}
	if(n==1)
	{
		cout<<"-1";
		return 0;
	}
	if(a[n-1]-a[n-2]<0||a[n-1]==15)
	ans="DOWN";
	else ans="UP";

	cout<<ans;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int ara[100];
    for(int i=0;i<n;i++)
    {
        cin>>ara[i];
    }
    if(n==1)
    {
        if(ara[n-1]==15)
        {
            cout<<"DOWN";
        }
        else if(ara[n-1]==0)
        {
            cout<<"UP";
        }
        else
        {
            cout<<-1;
        }
    }
    else if(ara[n-1]==1)
    {
        cout<<"UP";
    }
    else if(ara[n-1]==0)
    {
        cout<<"UP";
    }
    else if(ara[n-1]==15)
    {
        cout<<"DOWN";
    }
    else if(ara[n-1]-ara[n-2]>0)
    {
        cout<<"UP";
    }
    else if(ara[n-1]-ara[n-2]<0)
    {
        cout<<"DOWN";
    }
}

#include<iostream>
#include<stdio.h>
#include<cstring>

using namespace std;

int main(){
    int N,data[1000],up=0,down=0;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>data[i];
    }
    string kata = "";
    string hasil = "";
    if(data[0]<data[1]){
        kata = "UP";
        hasil = "UP";
    }else{
        kata = "DOWN";
        hasil = "DOWN";
    }
    if(N!=1){
    for (int i=0;i<N;i++){
        if(data[i]==data[i+1]){
            hasil = "-1";
            break;
        if(data[i]==15 && kata=="UP"){
            hasil = "DOWN";
            kata = "DOWN";
            //cout << hasil << " " ;
        }else if(data[i]==0 && kata=="DOWN"){
            hasil = "UP";
            kata = "UP";
            //cout << hasil << " ";
        }
        }
    }
    }else if(data[0]==15 || data[0]==0){
        if(data[0]==15){
            hasil = "DOWN";
        }else{
            hasil = "UP";
        }
    }else{
        hasil = "-1";
    }
    cout << hasil << endl;
return 0;
}

#include <bits/stdc++.h>
#define ll long long

using namespace std;
ll n, a[93];
int main(){
	cin >> n;
	for(int i = 1; i <= n; i++){
	    cin >> a[i];
	}
	if(a[n] > a[n - 1] && n > 1){
	    cout << "UP";
	    return 0;
	}
	if(a[n] < a[n - 1] && n > 1){
	    cout << "DOWN";
	    return 0;
	}
	if(a[n] == 15){
	    cout << "DOWN";
	    return 0;
	}
	if(a[n] == 0){
	    cout << "UP";
	    return 0;
	}
	if(n == 1){
	    cout << -1;
	    return 0;
	}
}

#include<iostream>
using namespace std;
int main()
{

	int n;
	cin >> n;
	int x, y,z;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		if (i == n - 2)
			y = x;
		if (i == n - 1)
			z = x;

	}
	if (n == 1)
	{
		if (x == 0)
			cout << "UP" << endl;
		if (x == 15)
			cout << "DOWN" << endl;
		else {
			cout << -1 << endl;
		}
		return 0;

	}
	else {
		if (z > y&&z!=15)
			cout << "UP" << endl;
		else {
			cout << "DOWN" << endl;
		}

	}
//sd

}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int a[n];
    for (int i = 0 ; i < n ; i++){
        scanf("%d",&a[i]);
    }
    if (n==1&&a[n]!=15&&a[n]!=0){
        printf("%d\n",-1);
    }
    if (a[n] == 15){
        printf("DOWN\n");
    }
    if (a[n] == 0 ){
        printf("UP\n");
    }
    if (a[n]-a[n-1]==1&&a[n]!=15){
        printf("UP\n");
    }
    if (a[n]-a[n-1]==-1){
        printf("DOWN\n");
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
long long n,i,j,k,l,ans=0,curr,curr2;
vector <long long> v;

int main() {
	cin>>n;

	for(i=0;i<n;i++){
	    cin>>k;
	    v.push_back(k);

	} if(n==1 && k!=15){cout<<"-1"; return 0;}

	if(v[n-1] > v[n-2] && v[n-1] != 15) {cout<<"UP"; return 0;}
	  else cout<<"DOWN";

}

/**
The way I see may make you blind
The way I think may scar your mind
And evil are the words I speak
I am sin and sin you seek

Begging...
Thirsting...
Feeding...
**/
#include<iostream>
#include<fstream>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<assert.h>
#include<vector>
#include<stack>
#include <utility>
#include<set>
#include<bitset>
#include<queue>
#include<map>
#include<valarray>
#include<numeric>
/*=^=^=^=^=^=^==^=^=^=^=^=^==^=^=^=^=^=^==^=^=^=^=^=^==^=^=^=*/
/* _______        __    _  _______  _______  _______  ______
  |   _   |      |  |  | ||   _   ||       ||       ||    _ |
  |  |_|  |      |   |_| ||  |_|  ||  _____||    ___||   | ||
  |       |      |       ||       || |_____ |   |___ |   |_||_
  |       | ___  |  _    ||       ||_____  ||    ___||    __  |
  |   _   ||   | | | |   ||   _   | _____| ||   |___ |   |  | |
  |__| |__||___| |_|  |__||__| |__||_______||_______||___|  |_|

*/
/*=^=^=^=^=^=^==^=^=^=^=^=^==^=^=^=^=^=^==^=^=^=^=^=^==^=^=^=*/
using namespace std;
#define pi 3.14159265359
#define pb push_back
#define po pop_back
#define pf push_front
#define mp make_pair
#define all(v) ((v).begin()),((v).end())
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vint;
typedef vector<string> vstr;
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}
//void openfile()
//{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
//}
bool sortPairsCmp(const pair<int, int>&a, const pair<int, int>&b)
{
	return a.first*b.second < a.second*b.second;
}
int toInt(string str)
{
	int num;
	istringstream iss(str);
	iss >> num; return num;
}
template<class T> string toStr(T par)
{
	ostringstream oss;
	oss << par;
	return oss.str();
}
string toBinary(int n)
{
	std::string r;
	while (n) { r = (n % 2 == 0 ? "0" : "1") + r; n /= 2; }
	return r;
}
int count_true_bits(int a)
{
	int mask;
	int count = 0;
	for (mask = 1; mask; mask <<= 1)
	{

		if (mask & a) ++count;
	}
	return count;
}
ll gcd(ll a, ll b)
{
	if (b == 0)return a; else return gcd(b, a % b);
}
ll lcm(ll a, ll b)
{
	return(a / gcd(a, b)*b);
}
int main()
{
	fast();
	int x, y,z,b; cin >> x; if (x == 1)return(cout << -1), 0;
	vint s(x);
	for (int i = 0; i < x; i++)
		cin >> s[i];
	bool out = 1;
	for (int i = 0; i < x - 1; i++)
		if (s[i + 1] != s[i])out = 0;
	if(out)return(cout << -1), 0;
	bool up = true;
	for (int i = 0; i < x - 1; i++)
	{
		if (s[i + 1] > s[i])up = false;
		else up = true;
	}
	if (up)cout << "DOWN";
	else cout << "UP";
}

#include <iostream>
using namespace std;
int main(void)
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(n==1 && a[0]!=15 && a[0]!=1)
        cout<<-1<<endl;
    else if(a[0]==15)
        cout<<"DOWN"<<endl;
    else if(a[0]==0)
        cout<<"UP"<<endl;
    else if(a[n-1]==15)
        cout<<"DOWN"<<endl;
    else if(a[n-1]==1)
        cout<<"UP"<<endl;
    else if((a[n-2]<a[n-1])&&a[n-1]!=15)
        cout<<"UP"<<endl;
    else if((a[n-1]<a[n-2])&&a[n-2]!=0)
        cout<<"DOWN"<<endl;
}

#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    int n,data,prev,count=0,nsave;
    cin>>n;
    cin>>data;
    prev=data;
    nsave=n;
    --nsave;
    while(nsave--)
    {
        cin>>data;
        count+=prev-data;
        prev=data;
    }
    if(n==1 && prev==0)
        cout<<"UP";
    else if(n==1 && prev==15)
        cout<<"DOWN";
    else if(n==1)
        cout<<-1;
    else if(count>0 || count==0)
        cout<<"DOWN";
    else if(count<0)
        cout<<"UP";
}

#include <iostream>
#include <fstream>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <iomanip>      //setprecision
using namespace std;

int main()
{
//////////////////////////////////////
    #ifndef ONLINE_JUDGE            //
                                    //
         ifstream cin(".in");       //
        // ofstream cout(".out");   //
    #endif                          //
//////////////////////////////////////

    int n;
    int a[100];

    cin >> n;

    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }

    if(n == 1 && a[1] == 1)
    {
        cout << "UP";
        return 0;
    }

    if(a[n] == 15)
    {
        cout << "DOWN";
        return 0;
    }

    for(int i = 1; i <= n; i++)
    {
        if(a[n] - a[n - 1] == 1)
        {
            cout << "UP";
            return 0;
        }

        if(a[n] - a[n - 1] == -1)
        {
            cout << "DOWN";
            return 0;
        }
    }

    cout << -1;

    return 0;
}

#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<iomanip>
using namespace std;

long long fact(long long n)
{
	long long f = 1;
	for (long long i = n; i >= 1; i--)
		f *= i;
	return f;
}

int gcd(int a, int b)
{
	if (b == 0)
		return a;
	return gcd(b, a%b);
}

int divisor(int n)
{
	int sum = 0;
	if (n / sqrt(n) == sqrt(n))
		sum--;
	for (int i = 1; i <= sqrt(n); i++)
	if (n%i == 0)
		sum += 2;
	return sum;
}

bool prime(long long n)
{
	for (long long i = 2; i*i <= n; i++)
	if (n%i == 0)
		return false;
	return true;
}

bool palindrome_str(string n)
{
	int x = 0;
	int m = n.size() / 2;
	int r = n.size();
	for (int i = 0; i < m; i++)
	if (n[i] == n[r - i - 1])
		x++;
	if (x == m)
		return true;
	return false;
}

bool palindrome_num(int n)
{
	int x = 0, a[10000], r = 0;
	while (n)
	{
		a[r++] = n % 10;
		n /= 10;
	}
	for (int i = 0; i < r / 2; i++)
	if (a[i] == a[r - i - 1])
		x++;
	if (x == r / 2)
		return true;
	return false;
}

void small(string n)
{
	for (int i = 0; i < n.size(); i++)
	if (n[i] >= 'A'&&n[i] <= 'Z')
		n[i] += 32;
}

/*void file()
{
	freopen("interesting.in", "r", stdin);
	freopen("Name of output file", "w", stdout);
}*/

void capital(string n)
{
	for (int i = 0; i < n.size(); i++)
	if (n[i] >= 'a'&&n[i] <= 'z')
		n[i] -= 32;
}

void fast()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

int main()
{
	fast();
	int n, arr[2001],x=0,s=0;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	for (int i = 0; i < n; i++)
	if (arr[i] == 15)
		x++;
	else
	if (arr[i] == 0)
		s++;
	if (n == 1)
	{
		cout << -1 << endl;
		return 0;
	}
	if ((x % 2 == 0 && s % 2 != 0 || x == 1)&&x!=0)
	{
		cout << "DOWN\n";
		return 0;
	}
	cout << "UP\n";
	//system("pause");
}

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int n,k,m,p;
	scanf("%d",&n);
	int a[n+1];
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	if(n==1)
	{
		if(a[n-1]==15)
			printf("DOWN\n");
		else
			printf("-1\n");
	}
	else
	{
		int te = a[n-1];
		int te2 = a[n-2];
		if(te==1 || te==0)
			printf("UP\n");
		if(te2<te && te!=15 )
			printf("UP\n");
		else if(te>=te2 && te!=1 && te!=0)
			printf("DOWN\n");
	}
	return 0;
}

#include <iostream>
#include <algorithm>

using namespace std;

long long n, i, nr = 0, j, Min = 999999999, k, m, s, x, Max;
long long y, curr, last, d;
int  *v;

int main()
{
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> x;
		if(i != n - 1)
			y = x;
	}
	if (n == 1) {cout << -1; return 0;}
	if (x - y < 0) cout << "DOWN";
	else
		cout << "UP";

	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main(void)
{

	int n, tab [100];
	cin >> n;
	for (int i=0; i<n; i++) cin >> tab[i];

	if(n==1) {if (tab[n-1]==0 ||tab[n-1]==15) cout << "up";
	else cout << "-1";}

	if (n>1){
	if(tab[n-1] < tab[n-2]) cout << "DOWN";
	if(tab[n-1] > tab[n-2]) cout << "UP";}

}

#include <iostream>

using namespace std;

int main()
{  int x, s;
   cin >> x;
   int a[x];
   for ( int s=0 ; s<x  ; s++ ) {  cin >> a[s]; }
    if ( a[s]==15) cout << " DOWN ";
    else if ( a[s]==1 ) cout <<  " UP ";
    else if (a[s]>a[s-1]) cout << " UP ";
    else if (a[s]<a[s-1]) {cout << "DOWN"; return 0;}
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define vite ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define tst ll T; cin>>T; while(T--)
#define mod 1000000007
#define MAX 1e9
#define MIN -1e9
#define ll long long int
#define vt vector
#define pb push_back
int main()
{
    clock_t start, end;
    start = clock();
    vite;
    ll n;
    cin >> n;
    ll a[n];
    for (ll i = 0; i < n;i++)
        cin >> a[i];
    if(n==1&&a[0]!=15&&a[0]!=0)
        cout << "-1";
    else if(n==1&&a[0]==15&&a[0]!=0)
        cout << "DOWN";
    else if(n==1&&a[0]!=15&&a[0]==0)
        cout << "UP";
    else if(a[n-1]-a[n-2]>0&&a[n-1]!=15)
        cout << "UP";
    else
        cout << "DOWN";
    end = clock();
    cout<<endl;
    double time_taken = double(end - start) / double(CLOCKS_PER_SEC);
    // cout<<fixed << time_taken << setprecision(5);
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)
        cin >> a[i];
    if(n == 1)
    {
        cout << -1;
        return 0;
    }
    if(a[n-1] == 0)
        cout << "UP";
    else if(a[n-1] == 15)
        cout << "DOWN";
    else if(a[n-1] > a[n-2])
        cout << "UP";
    else if(a[n-2] > a[n-1])
        cout << "DOWN";
}

#include <iostream>

int main() {
    int n, arr[92];

    std::cin >> n;
    for (int i=0; i<n; i++)
        std::cin >> arr[i];

    if (arr[n-1] == 0)
        std::cout << "UP";
    else if (n == 1) {
        if (arr[n-1] == 15)
            std::cout << "DOWN";
        else
            std::cout << -1;
    }
    else {
        if (arr[n-2] < arr[n-1] && arr[n-1] <= 14)
            std::cout << "UP";
        else if (arr[n-2] > arr[n-1] && arr[n-1] > 1 || arr[n-1] > 14)
            std::cout << "DOWN";
    }

    return 0;
}

#include<iostream>
using namespace std;
int n;

int main()
{
    cin>>n;
    int ar[n];

    for(int i=0;i<n;i++)
    {
        cin>>ar[i];

    }
    if(n==1)
    {
        cout<<"-1";
    }
    else if(ar[n-1]>ar[n-2])
    {
        cout<<"UP";
    }
    else if(ar[n-1]<ar[n-2])
    {
        cout<<"DOWN";
    }

        return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int d,i,n;
    cin>>d;
    int a[d];
    for(i=1; i<=d; i++)
    {
        cin>>a[i];
    }
    //cout<<a[d]<<endl;
    if(a[d]==1)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    //n=a.length();
    for(i=1; i<=d; i++)
    {
        if(a[d]==15)
        {
            cout<<"DOWN"<<endl;
            return 0;
        }
        else if(a[d]==0)
        {
            cout<<"UP"<<endl;
            return 0;
        }
        else if(a[d]>a[d-1])
        {
            cout<<"UP"<<endl;
            break;
        }
        else if(a[d]<a[d-1])
        {
            cout<<"DOWN"<<endl;
            break;
        }
    }
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/
int main()
{
    int x;
    cin>>x;
    int arr[x];
    for(int i=0;i<x;i++)
    {
        cin>>arr[i];
    }
    if(x==1){cout<<-1<<endl;return 0;}
    if(arr[x-1]>arr[x-2]){cout<<"UP"<<endl;}
    else if(arr[x-1]<arr[x-2]){cout<<"DOWN"<<endl;}
    else{cout<<-1<<endl;}

    // Write an action using cout. DON'T FORGET THE "<< endl"
    // To debug: cerr << "Debug messages..." << endl;

}

#include <iostream>
using namespace std;
int main() {
	int n;
	bool increasing = true;
	cin >> n;
	int days[100];
	for (int i = 0; i < n; i++) {
		cin >> days[i];
	}
	if (n <= 1) {
		cout << -1;
		return 0;
	}
	for (int i = 0; i < n; i++) {
		if (days[n-1] >days[0]) {
			increasing = false;
		}

		else {
			increasing = true;
		}
	}

	if (increasing == false) cout << "UP";
	else cout << "DOWN";
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <algorithm>
#include <map>
#include <queue>

#define ll long long
#define sc(a) scanf("%d",&a);
#define LINF = (ll)
#define all(x) (x).begin(),(x).end();
#define rall(x) (x).rbegin(),(x).rend();
#define mp make_pair
#define pb push_back
const ll mod = 1000000007;
#define INF (int)(2e9 + 1e8);
#define LINF (ll)(9e18 + 2e17);

using namespace std;

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	vector<int>a(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	if (n == 1) {
		a[0] == 15 ? printf("DOWN") : printf("-1");
		return 0;
	}
	if (a[n-1] - a[n-2] > 0) {
		if (a[n - 1] != 15) return 0 & printf("UP");
		else printf("DOWN");
	}
	else printf("DOWN");
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
   int n,arr[93];
   cin>>n;

   for(int i=0;i<n;i++){
       cin>>arr[i];
   }
   if(n==1){
   if(arr[n-1]==0||arr[n-1]==15){cout<<"DOWN";}else{cout<<-1;}return 0;
   }
   if(arr[n-1]-arr[n-2]==1||arr[n-1]==0){
       cout<<"UP";
   }else if(arr[n-1]-arr[n-2]==-1||arr[n-1]==15){
       cout<<"DOWN";
   }
    return 0;
}

#include <iostream>
#include <string>
using namespace std;
int main()
{
	int n, k = 0, f = 0;
	cin >> n;
	int a[92];
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    if (n == 1){
	    cout << "-1";
	}
	else{
	    if (a[n-1] > a[n-2]){
	        if (a[n-1] == 15){
	            cout << "DOWN";
	        }
	        else{
	            cout << "UP";
	        }
	    }
	    else{
	        if (a[n-1] == 0){
	            cout << "UP";
	        }
	        else{
	            cout << "DOWN";
	        }
	    }
	}
}

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n;
    int a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    if(a[n]==0)
        cout<<"UP";
    else if(a[n]==15)
        cout<<"DOWN";
    else
    {
        if(a[n-1]<a[n])
            cout<<"UP";
        else
            cout<<"DOWN";
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,a[100],b,sum;
string r="UP";
int main()
{
	cin>>n;
	int M=-1;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];

	}
	for(int i=1; i<=n; i++)
	{
		if((a[i-1]==a[i+1]&&a[i]!=0)||M==a[i])
		{
			M=a[i];
			r="DOWN";
		}

		if(a[i]==0)
		r="UP";
	}
	if(n==1&&a[0]!=0)
	{
		cout<<-1;
		return 0;
	}
	cout<<r;
	return 0;
}

#include <iostream>
#include <fstream>

using namespace std;

int main () {
	ifstream in;
	in.open ("input.txt");
	int n = 0;
	in >> n;
	int a[31];
	for (int i = 0; i < n; i++)
		in >> a[i];
	if (n == 1){
		cout << "-1";
		return 0;
	}
	if (n > 1){
		if (a[n - 1] > a[n - 2])
			if (a[n - 1] != 15)
				cout << "UP";
			else
				cout << "DOWN";
		if (a[n - 1] < a[n - 2])
			if (a[n - 1] != 0)
				cout << "DOWN";
			else
				cout << "UP";
	}
	return 0;
}

	#include <iostream>
	#include<string>
	using namespace std;
	int main(){int n;
		cin>>n;
	int*a=new int[n];
	int i;
	for(i=0;i<n;i++)
		cin>>a[i];
	if(n==1)
	{cout<<"-1";
	return 0;
	}
	if(a[n-1]<a[n-2]||a[n-1]==15)
		cout<<"DOWN";
	else cout<<"UP";

	}

#include<iostream>
#include<stdio.h>
#include<cstring>

using namespace std;

int main(){
    int N,data[1000],up=0,down=0;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>data[i];
    }
    string kata = "";
    string hasil = "";
    if(data[0]<data[1]){
        kata = "UP";
        hasil = "UP";
    }else{
        kata = "DOWN";
        hasil = "DOWN";
    }
    if(N==1 && (N!=15 || N!=0)){
    for (int i=0;i<N;i++){
        if(data[i]==data[i+1]){
            hasil = "-1";
            break;
        }else if(data[i]==15 && kata=="UP"){
            hasil = "DOWN";
            kata = "DOWN";
            //cout << hasil << " " ;
        }else if(data[i]==0 && kata=="DOWN"){
            hasil = "UP";
            kata = "UP";
            //cout << hasil << " ";
        }
        }
    }else{
        hasil = "-1";
    }
    cout << hasil << endl;
return 0;
}

#include <iostream>
#include <ctype.h>

using namespace std;
int main()
{
    int n;
    cin >> n;
    int t[n];
    for(int i = 0; i < n; i++)
    {
        cin>>t[i];
    }
    if(n < 2)
    {
        cout<<"-1";
        return 0;
    }
    if(t[n-2] > t[n-1])
    {
        cout<<"DOWN";
    }
    else
    {
        cout<<"UP";
    }

}

#include <iostream>
using namespace std;

int main() {
	int n ;
	cin >> n;

	int prev,cur=0;
	for(int i = 0; i < n ;i++)
	{
	    prev = cur;
	    cin >> cur;
	}

	if(n==1 && cur!=15)
	{
	    cout << "-1" <<endl;
	    return 0;
	}

	if(n==1 && cur==15)
	{
	    cout << "DOWN" <<endl;
	    return 0;
	}
	if(prev>cur && cur ==1)
	    cout << "UP" <<endl;
	else if(prev>cur && cur!=1)
	    cout << "DOWN" <<endl;
	else if(prev<cur && cur ==15)
	    cout << "DOWN" <<endl;
	else if(prev<cur && cur !=15)
	    cout << "UP" <<endl;

	return 0;
}

#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>
#include <ctime>
#include <assert.h>
#include <sstream>
#include <stack>

using namespace std;

int main (){
	int n  ;
	cin >> n ;
	int  a  [100] ;
	int  x[] = {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} ;
	for (int i = 0 ; i < n ; i++)  cin >> a[i] ;

	if (n == 1 && (a[0]== 0)  ) {
		cout << "UP" ;
		return 0 ;
	}else if (n == 1  && (a[0] == 15)){
		cout <<  "Down"  ;
		return  0 ;
	}else if (n == 1) {
		cout << - 1;
	  return  0 ;
	}
	int j ;

	for (int i = 0 ; i < 30 ; i++)
		if (a[0] ==  x[i] && a[1] == x[i + 1] ) j = i ;

	  if ( x[j +  n % 30 ] > x[j + (n - 1) % 30]) cout << "UP" ;
	  else   cout << "DOWN";

		return 0 ;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    if(a[n-1]==15)
    {
        cout<<"DOWN"<<endl;
    }
    else if(a[n-1]==0)
    {
        cout<<"UP"<<endl;
    }
    else if(a[n-1]>a[n-2])
    {
        cout<<"UP"<<endl;
    }
    else if(2>n)
    {
        cout<<"-1"<<endl;
    }
    else
    {
        cout<<"UP"<<endl;
    }

}

#include<bits/stdc++.h>
using namespace std;
int moon[30];
int main(void){

	int n;
	while( scanf("%d",&n)!=EOF){

	for( int i=0;i<=15;i++)
	     moon[i] = i;
	int cnt = 2;
	for( int i=16;i<=29;i++){
	     moon[i] = moon[i-cnt];
	     cnt+=2;
	}
    int num[109];
    int maxx = -1 ,cur ;
	for( int i=0;i<n;i++){
    	  scanf("%d",&num[i]);
          if( num[i] >= maxx ){
          	  maxx = num[i];
          	  cur = i;
		  }
	 }
 	if( n == 1 ){
		printf("-1\n");
		continue;
 	}
	 /*
	 if( cur == n -1 ){
	 	 if( num[cur] > num[cur -1 ] ){
	 	 	 if( num[cur]== 15 ){
	 	 	 	 printf("DOWN\n");
			   }
			 else printf("UP\n");
		  }
		 else if( num[cur] < num[cur-1] ){
		 	   printf("UP\n");
		 }

	 }
	 else {

	 	  int tmp =  n -  cur;
	 	  if( tmp <= ){

		   }

	 }
	 */

	 if(  num[cur] <  15  ){
	 	  if( num[n-1] > num[n-2] )
	           printf("UP\n");
	      else if( num[n-1] != 0 )
		        printf("DOWN\n");
	      else printf("UP\n");
	   }
	  else if( num[cur] == 15 ){
	        int tmp = n - 1 - cur;
			if( tmp < 15 ){
				printf("DOWN\n");
			}
	  	    else printf("UP\n");
	  }

}
	return 0;
}

#include <iostream>

using namespace std;

int arr[100];

int main(){
	int n, num;
	int k = 0;
	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> num;
		arr[i] = num;
		k++;
	}

	if (arr[n-1 == 1] && k%2 != 0){
		cout << "UP";
		return 0;
	}

	if (arr[n - 1 == 1] && k%2 == 0){
		cout << "DOWN";
		return 0;
	}

	if (k < 2){
		cout << -1;
		return 0;
	}

	if (arr[n - 1] == 15){
		cout << "DOWN";
		return 0;
	}

	if (arr[n - 1] > arr[n - 2]){
		cout << "UP";
		return 0;
	}

	if (arr[n - 1] < arr[n - 2]){
		cout <<"DOWN";
		return 0;
	}

	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main(void)
{

	int n, tab [100];
	cin >> n;
	for (int i=0; i<n; i++) cin >> tab[i];

	if(n==1)
	{
	if (tab[n-1]==0 ||tab[n-1]==15) cout << "up";
	else cout << "-1";
	}

	if (n>1)
	{
		if(tab[n-1]==15) cout << "DOWN";
		if(tab[n-1]==0) cout << "UP";
	}
	else
	{
	if(tab[n-1] < tab[n-2]) cout << "DOWN";
	if(tab[n-1] > tab[n-2]) cout << "UP";
	}

}

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<stack>
#include<queue>

#define ms(x,y) memset(x,y,sizeof(x))
#define req(i,a,b) for(int (i) = (a); (i)<(b); (i)++)
#define sqr(x) (x)*(x)
#define sa(n) scanf("%d",&n)
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

using namespace std;
/**************************************head************************************/
const int maxN = 92 + 10;
int a[maxN];

int main()
{
	int n;
	string ans;
	cin >> n;
	for(int i = 0;i<n;i++)
		cin >> a[i];
	if(n == 1){
		cout << "-1";
		return 0;
	}
	if(a[n-1] - a[n-2] > 0 && a[n-1] != 15) ans = "UP";
	else if(a[n-1] - a[n-2] > 0 && a[n-1] == 15) ans = "DOWN";
	else if(a[n-1] - a[n-2] < 0 && a[n-1] != 0) ans = "DOWN";
	else if(a[n-1] - a[n-2] < 0 && a[n-1] == 0) ans = "UP";
    cout << ans<<endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,a[1000];
    int i;

    cin>>n;

    for(i=1;i<=n;i++)
        cin>>a[i];

    if(n==1 && a[n]!=0)
        cout<<-1<<endl;
    else if(n==1 && a[n]==0)
        cout<<"UP"<<endl;

    else{

        if(a[n-1]+1==a[n])
            cout<<"UP"<<endl;
        else if(a[n]+1==a[n-1])
            cout<<"DOWN"<<endl;
    }

    return 0;

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
     int d,i,n;
     cin>>d;
     int a[d];
     for(i=0;i<d;i++)
     {
          cin>>a[i];
     }
     if(d==1) cout<<"-1"<<endl; return 0;
     //n=a.length();
      for(i=0;i<d;i++)
     {
          if(a[d-1]>a[d-2])
          {
               cout<<"UP"<<endl;
               break;
          }
          else if(a[d-1]<a[d-2])
          {
               cout<<"DOWN"<<endl;
               break;
          }
     }
}

#include<bits/stdc++.h>
using namespace std;
int a[93];
int main(){
	ios::sync_with_stdio(false);
	long long int n,dw=0,up=0;
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>a[i];
	}
		for(int i=0;i<=n;++i){
			if(n==1){
			cout<<-1;
			return 0;
		}
		if(a[n-1]==15){
		cout<<"DOWN";
		return 0;
		}
		else if((a[n-1]>a[n-2])||(a[0]==0&&n==1)||(a[n-1]==0)){
	cout<<"UP";
	return 0;
	}

	}
}

#include <iostream>
# include <cmath>
using namespace std;

int main()
{
    int x,y[x];
    cin>>x;
    for(int i=0; i<x; i++)
    {
        cin>>y[i];
    }
    if(x==1)
    {
        cout<<"-1";
    }
    else if(y[x-1]>y[x-2])
    {
        cout<<"UP";
    }
    else
    {
        cout<<"DOWN";
    }

    return 0;
}

#include<iostream>
#include<string>
#include<set>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
using namespace std;
typedef long long ll;
ll asd(ll x,ll y,ll z)
{
	if(y%x!=0||z%x!=0)
		return asd(x-1,y,z);
	else if((y%x==0&&z%x==0)||x==1)
		return x;
}

int main()
{
	int n,x;
	vector<int>asd;
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>x,asd.push_back(x);
	if(n==1)
		cout<<-1<<endl;
	else if(asd[n-2]-asd[n-1]>0)
		cout<<"DOWN\n";
	else if(asd[n-2]-asd[n-1]<0)
		cout<<"UP\n";
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define oset tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update>
#define t pair<lli, lli>
#define duoset tree<t, null_type, less<t>, rb_tree_tag, tree_order_statistics_node_update>

#define lli long long int
//cout << fixed << setprecision(2) << num1;
int days[36] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31, 30,
                31, 30, 31, 31, 30, 31, 30, 31, 31, 29, 31, 30, 31, 30, 31, 31,
                30, 31, 30, 31
               };

//Even and odd numbers between n and m
//count = m - n + 1;
// even = (count >> 1) + (count & 1 && !(n & 1));

int main(void)
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r" , stdin);
	freopen("output.txt" , "w" , stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	lli  T, i = 0, j = 0, ans = 0, con = 0, val = 0, n, index;
	string s, str, snew;

	cin >> n;
	vector<lli>a(n);
	lli v[60] = {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
	            };

	for (i = 0; i < n; i++)cin >> a[i];
	lli chk;
	if (n == 1 && a[0] != 0)cout << "-1";
	else if (n == 1 && a[0] == 0)cout << "UP";
	else if (n == 1 && a[0] == 15)cout << "DOWN";
	else {
		lli val1 = a[n - 4];
		lli val2 = a[n - 3];
		lli val3 = a[n - 2];

		lli val4 = a[n - 1];
		for (i = 0; i < 60; i++) {
			if ( i + 2 < 60 && i + 1 < 60 && v[i] == val1 && v[i + 1] == val2 && v[i + 2] == val3
			        && v[i + 3] == val4) {
				chk = v[i + 4]; break;
			}
		}
		//cout << chk;
		if (chk > val4)cout << "UP";
		else cout << "DOWN";

	}

	return 0;
}// end of main

#include <iostream>
using namespace std;

int main()
{
	int n;
	cin>>n;
	int a[92];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	if(n==1){cout<<"-1";return 0;}

	for(int i=n-1;i>=0;)
	{
		if(a[i]>a[i-1]){
			if(a[i-1]>a[i-2])
			cout<<"UP";return 0;
		}else{
			if(a[i-1] < a[i-2])
			cout<<"DOWN";return 0;
		}
	}
}

#include <iostream>
using namespace std;

int main()
{
	int n;
	cin>>n;
	int a[92];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	if(n==1){cout<<"-1";return 0;
	}
	if(a[n-1]>a[n-2] && a[n-1]!= 15){
			if(a[n-1]==0){
			 	cout<<"UP";return 0;
			 }
			cout<<"UP";return 0;

	}else{
			 if(a[n-1]==0){
			 	cout<<"UP";return 0;
			 }
			 else if(a[n-1]==1){
			 	cout<<"DOWN";return 0;
			 }
			 if(a[n-1]==15){
				cout<<"DOWN";return 0;
			}
			cout<<"DOWN";return 0;
	}
}

#include<iostream>
using namespace std;

int main() {

    int n,i,a[92];
    cin>>n;
    for(i=0;i<n;i++) cin>>a[i];
    if(n==1 && a[n-1]!=15) cout<<-1<<endl;
    if(a[n-1]==15) cout<<"DOWN";
    if(n!=1)
    {
    if(a[n-1]<15)
            {
                if(a[n-2]<a[n-1]) cout<<"UP";
                if(a[n-2]>a[n-1]) cout<<"DOWN";
            }
    }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
   int size;
   int a[30];
   for(int i=0;i<=15;i++)
   {
       a[i]=i;
   }
int   f=16;
   for(int i=14;i>=1;i--)
   {
       a[f]=i;
       f++;
  }
scanf("%d",&size);
int a2[size];
for(int i=0;i<size;i++)
{
    scanf("%d",&a2[i]);
}
   if(size==1)
   {
       printf("-1");
       return 0;
   }
   else
   {
       if(a[a2[size-1]]<a[a[size-2]])
       {
           printf("DOWN");
       }
   }
   printf("UP");
    return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

long long a[1000], x2,y2, n, m, k;
long long sum;

int main (){

	cin >> n;

	for(int i = 0; i < n; i++){
		cin >> a[i];
	}

	if(n == 1){
		cout<<-1;
	}

	else if(a[n-2]< a[n-1] && a[n-1]== 15){
		cout<<"DOWN";
	}
	else if(a[n-2] < a[n-1] || (a[n-2] > a[n-1] && a[n-1] == 0)){
		cout<<"UP";
	}
	else if(a[n-2] < a[n-1]){
		cout<<"UP";
	}
	else{
		cout<<"DOWN";
	}

	return 0;
}

//#define _CRT_SECURE_NO_WARNINGS
//#include "pch.h"
#include <iostream>
#include<iomanip>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<math.h>
#include<set>
#include<map>
#include<deque>
#include<queue>
#include <complex>
#include <list>
#include <climits>
#include <cctype>
#include <bitset>
#include <cstdlib>
#include <ctime>
#include <functional>
#include<stdio.h>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
#define  ll long long
#define  ull unsigned long long
#define  ul unsigned long
#define  Mahmoud fast();

#define mod 1000000007
#define ex(n) return cout<<n<<finl,0;

void fast() {

	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);

#ifdef ONLINE_JUDGE
	//freopen("alice.in ", "r", stdin);

	//freopen("little.out", "w", stdout);
#endif
#ifndef ONLINE_JUDGE
	//freopen("input.in", "r", stdin);

	// freopen("output.out", "w", stdout);
#endif
}

ll ConvertToInt(string s)
{

	stringstream geek(s);
	ll x = 0;
	geek >> x;

	return x;

}

bool CheckConsecutive(ll num)
{

	double dou = log2(num);

	int ans = dou;

	if (ans == dou)
		return true;
	else
		return false;
}

string ConverToString(ll n)
{
	string Result;

	stringstream convert;

	convert << n;

	Result = convert.str();

	return Result;

}

// You can do it ^_^
ll arr1[1000000], arr2[1000000];
const ll md = 1e9 + 7;
const double PI = 3.141592654;

int fre[100000];

int main()

{

	//freopen("notshort.in", "r", stdin);

	Mahmoud

		ll n;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> arr1[i];
	}
	if (n == 1 &&arr1[n-1]!=15)
	{
		cout <<-1<< "\n";
		return 0;
	}

	if (arr1[n - 1] > arr1[n - 2]&&arr1[n-1]!=15)
		cout << "UP" << "\n";
	else
		cout << "DOWN" << "\n";

	return 0;
}

#include <bits/stdc++.h>

typedef long long ll;
typedef long double ld;
typedef signed long long sll;
typedef unsigned long long ull;
#define all(s) ((s).begin()),((s).end())
#define rall(s) ((s).rbegin()),((s).rend())
using namespace std;

void Yuko_Kurama()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
}
int main()
{
    Yuko_Kurama();

    int n;
    while(cin>>n)
    {
        vector<int> v(n);
        for(int i=0;i<n;i++) cin>>v[i];
        string ans="-1";
        if(n<=1 || v[n-2]==v[n-1])
        {
            if(v[0]==0) cout<<"UP"<<endl;
            else ans="-1";
        }
        else if(v[n-2]<v[n-1]) ans="UP";
        else ans="DOWN";
        cout<<ans<<endl;
    }

    return 0;
}

#include <iostream>
using namespace std;
int main () {
	int n,ind=0;
cin>>n;
   int a[n+1];
for(int k=1; k<=n; k++)
cin>>a[k];
if(n==1){
	cout<<-1;
	return 0;
}
if(a[n]>a[n-1] && a[n]!=15){
 cout<<"UP";
 return 0;
}
if(a[n-1]>a[n] && a[n]!=0) cout<<"DOWN";

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,a[105];
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    if(n==1||a[n-1]==a[n])
        cout<<"-1"<<endl;
    else if(a[n-1]<a[n])
        cout<<"UP"<<endl;
    else
        cout<<"DOWN"<<endl;
    return 0;
}

#include <iostream>
using namespace std;

int a[93];

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	if (n == 1 && a[1] == 0) {
		cout << "UP" << endl;
	}
	else if (n == 1 && a[1] == 15) {
		cout << "DOWN" << endl;
	}
	else if (n == 1) {
		cout << -1 << endl;
	}
	else {
		if (a[n] > a[n - 1] && a[n] != 15) {
			cout << "UP" << endl;
		}
		else if (a[n] == 15 || a[n] < a[n - 1]) {
			cout << "DOWN" << endl;
		}
	}
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int a[100],i,n,flag;
    while(cin>>n)
    {
        memset(a,0,sizeof(a));
        flag=0;
        for(i=1; i<=n; i++)
        {
            cin>>a[i];
            if(a[i]==0)
                flag++;
        }

        if(n==1||flag==n)
            cout<<"-1"<<endl;
        else
        {
            if(a[n]>a[n-1]&&a[n]<=15)
                cout<<"UP"<<endl;
            else if(a[n]<a[n-1])
                cout<<"DOWN"<<endl;
        }
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> arr(n);
    if(n == 1)
    {
        cout << -1 << endl;
        return 0;
    }
    for(int i = 0; i < n; ++ i)
    {
        cin >> arr[i];
    }
    if(arr[n - 1] > arr[n - 2] && arr[n - 1] != 0)
    {
        cout << "UP" << endl;
    }
    else
    {
        cout << "DOWN" << endl;
    }
    return 0;
}

#include <iostream>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n+1];
	for (int i = 1; i <= n; ++ i){
		cin >> a[i];
	}
	if (n == 1 && a[n] == 15){
		cout << "DOWN";
		return 0;
	}
	if (n == 1 && a[n] == 0){
		cout << "UP";
		return 0;
	}
	if (n == 1 && a[n] != 15){
		cout <<-1;
		return 0;
	}
	if  (a[n-1] > a[n] || a[n] == 15){
		cout << "DOWN";
		return 0;
	}
	if  (a[n-1] < a[n] && a[n] != 15){
		cout << "UP";
		return 0;
	}
}

#include<iostream>
#include<string>
#include<ctime>
#include<algorithm>
#include<cmath>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<sstream>
using namespace std;
//double ±1.7×10^-308 ~ ±1.7×10^308
#define inf 2147483647//2^31
#define ll 9223372036854775807//2^64'
#define eps 1e-9
#define con continue
#define bk break
#define LL long long
#define db double
#define ms(a, b) memset((a), (b), sizeof(a))
#define mp make_pair
#define endl '\n'
#define se second
#define fi first
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef pair<int,int> pii;typedef pair<db,db> pdd;typedef pair<LL,LL> pll;
/*struct data  {
data(int sX, int sY, int sZ){
	int x,y,z;
	x = sX  ;  y = sY;  z = sZ;  }   };*/
int main()
{
	int a;
	while(cin>>a){
		int A[1204]={};
		for(int i=0;i<a;i++){
		cin>>A[i];
		}
		if(a==1&&A[0]==0){
		cout<<"UP"<<endl;
		con;
		}
		if(a<=1){
		cout<<-1<<endl;
		con;
		}
		if(A[a-1]==15&&A[a-2]==14){
		cout<<"DOWN"<<endl;
		}
		else if(A[a-1]==1&&A[a-2]==2){
		cout<<"UP"<<endl;
		}
		else if(A[a-1]==0&&A[a-2]==1){
		cout<<"UP"<<endl;
		}
		else if(A[a-1]>A[a-2]){
		cout<<"UP"<<endl;
		}
		else{
		cout<<"DOWN"<<endl;
		}

	}

	return 0;
}

#include <iostream>
using namespace std;

bool verf(int a[],int b) {
	bool ver=true;
	for(int i=0;i<b;i++) {
		if(a[i]<0 || a[i]>15) {
			ver=false;
			break;
		}
	}
	return ver;
}

bool upward(int a[],int b) {
	bool ver=true;
	for(int i=0;i<b-1;i++) {
		if(a[i]!=a[i+1]-1 || a[i]==15 || a[i+1]==15) {
			ver=false;
		} else {
			ver=true;
		}
		if(a[i+1]==0) {
			ver=true;
		}
	}
	return ver;
}

bool downward(int a[],int b) {
	bool ver=true;
	for(int i=0;i<b-1;i++) {
		if(a[i]!=a[i+1]+1 || a[i]==0 || a[i+1]==0) {
			ver=false;
		} else {
			ver=true;
		}
		if(a[i+1]==15) {
			ver=true;
		}
	}
	return ver;
}

int main() {
	int days,cont=0,out;
	cin >> days;
	if(days>=1 && days<=92) {
		int cons[days];
		for (int i=0; i<days; i++)
        		cin >> cons[i];
		if(verf(cons,days)) {
			if(days<2 || (!upward(cons,days) && !downward(cons,days))) {
				cout<<-1;
			} else {
				if(upward(cons,days)) {
					cout<< "UP";
				} else {
					if(downward(cons,days)) {
						cout<<"DOWN";
					}
				}
			}
		}
	}
}

#include <bits/stdc++.h>
using namespace std;
#define V(i) vector<i>
#define rep(i, n) for (__typeof(n) i = 0; i < n; i++)
#define crep(i,N,n) for (__typeof(n) i = N; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define P(i,j) pair<i,j>
#define MP make_pair
#define MOD 1000000007
typedef long long ll;
typedef long l;
#define fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

int main()
{

    ll n,las,lbo;
    cin>>n;
    rep(i,n-2)
    {
        ll tt;
        cin>>tt;
    }
    cin>>lbo>>las;
    if(n==1)
    {
        cout<<-1;
        return 0;
    }
    if(las == 15)
    {
        cout<<"DOWN";
    }
    else if(lbo == 0)
    {
        cout<<"UP";

    }

    else
    {
        if(las>lbo)
        {
            cout<<"UP";
        }
        else
        {
            cout<<"DONW";
        }

    }

    return 0;
}

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
    long long int a;
    cin>>a;
    string s;
    int n[a];
    for(int i=0;i<a;i++)
    {
        cin>>n[i];
    }
    if(n[a-2]>n[a-1] || n[a-1]==15)
        {
            cout<<"DOWN";
        }
        else if(n[a-2]<n[a-1])
        {
            cout<<"UP";
        }
        else if(a==1)
    {
        cout<<-1;
    }
}

#include <iostream>
#include <cstdlib>
#include <cmath>
#include <conio.h>
#include <cstdio>
#include <cstring>
#include <ctime>
using namespace std;

int main()
{
	int a[92];
	int n;
	cin >> n;

	for (int i = 0; i != n; i++)
		cin >> a[i];
	if ( n != 1 || a[n-1] != 15 || a[n-1] != 0){
   		if ( a[n-1] > a[n-2] )
			cout << "UP";
		else cout << "DOWN";}
	else if (n = 1) cout << -1;
		else if (a[n-1] = 15) cout << "DOWN";
			else cout << "UP";

	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <functional>
#include <cstring>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <hash_map>
#include <fstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <vector>
#include <set>
#include <complex>
#include <list>
#include <climits>
#include <cctype>
#include <bitset>

using namespace std;

ifstream fin("document.in");
ofstream fout("document.out");
long long gcd( long long x, long long y )
{
   if( x < y )
      return gcd( y, x );

   long long f = x % y;
   if( f == 0 )
     return y;
   else
      return gcd( y, f );
}
long long atoll(string x)
{
long long c=0;
for(int i=0;i<x.size();i++){c*=10;c+=x[i]-'0';}
return c;
}
void ff(){
vector<long long>::iterator lw;
vector<long long >vec;
//fflush(stdout);
long long n;
	lw=lower_bound(vec.begin(),vec.end(),n);
	int indx=(lw- vec.begin());
	cout << vec[indx] << '\n';
	//cout.precision(10);
	//cout<<fixed<<mn<<endl;
}
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}

#define all(v)              ((v).begin()), ((v).end())
#define allr(v)             ((v).rbegin()), ((v).rend())
#define sz(v)               ((int)((v).size()))
#define clr(v, d)           memset(v, d, sizeof(v))
#define For(it,c)           for(__typeof(c.begin()) it=c.begin();it!=c.end();++it)
#define MP                  make_pair
#define lpv(i, v)           for(int i=0;i<sz(v);++i)
#define lpn(i, n)           for(int i=0;i<(int)(n);++i)
#define lps(i, j, n)        for(int i=(j);i<(int)(n);++i)
#define lpb(i, j, n)        for(int i=(j);i>=(int)(n);--i)
#define nul                 puts("")

typedef long long                   ll;
typedef long double                 LD;
typedef vector<int>                 vi;
typedef vector<ll>                  vl;
typedef vector<double>              vd;
typedef map<ll,ll>                 MAP;
typedef vector<pair<ll,ll>>        vp;

const ll  OO = 1e9 + 7;

//freopen("input.txt", "rt", stdin);
//freopen("output.txt", "wt", stdout);

/*int n,e;
vector<vector<ll>>adj;
vector<bool>visited;

void dfs(int node){
	visited[node]=true;
	lpn(i,adj[node].size()){
	int child=adj[node][i];
	if(!visited[child])
		dfs(child);
	}
}*/

int main()
{
  ll n;
 cin >> n;
   vl v(n);
  lpn(i,n){
   cin>>v[i];
   }
   bool f=0;
    lps(i,1,n){
		if(v[i]<v[i-1])f=1;
}
	 if(n==1){
		 if(v[0]==15){cout<<"DOWN";return 0;}
		  if(v[0]==0){cout<<"UP";return 0;}

		 else
		 cout<<-1;return 0;
	 }
	if(f)cout<<"DOWN";
	else {
		if(v[v.size()-1]==15)cout<<"DOWN";

		else
		cout<<"UP";}

  return 0;
}

#include <iostream>

using namespace std;

int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0; i<n; i++ )
	{
		cin >>a[i];
	}
	if(n<=1)
		cout<<-1;
	else
	{
			if((a[n-2]<a[n-1] || a[n-1]==0  )&& a[n-1]!=15 )
				cout<<"UP";
			else cout <<"DOWN";
	}

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int s;
	cin>>s;
	int a[s];
	for(int i =0;i<s;i++)
	{
		cin>>a[i];
	}
	if(s==1&&s>=14||s==0)
	{
		cout<<"-1";
	}
	else if (a[s-1]<a[s-2]||a[s-1]==15)
	{
		cout<<"DOWN";
	}

	else if (a[s-1]>a[s-2])
	{
		cout<<"UP";
	}

}

#include <iostream>

int main() {
    int n, arr[92];

    std::cin >> n;
    for (int i=0; i<n; i++)
        std::cin >> arr[i];

    if (n == 1 && arr[0] != 15 && arr[0] != 0)
        std::cout << -1;
    else if ((arr[n-1] > arr[n-1] && arr[n-1] != 15) || arr[n-1] == 0)
        std::cout << "UP";
    else
        std::cout<< "DOWN";

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,p=0,flag=0;
    cin>>n;
    int a[n];
    if(n==1)
    {
        cout<<"-1";
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(a[n-1]<15)
      cout<<"UP";
    else
      cout<<"DOWN";

     return 0;

}

/*.......................................
     .   *BISMILLAHIR RAHMANIR RAHIM*   .
     .       *ALLAH is Almighty*        .
     ....................................
  ********************************************
  *   . . . . . . . . . . . . . . . . . ..   *
  *   .  Solved_by: zitul_mahmud_iu;     .   *
  *   .  Applied_physics & electronics;  .   *
  *   .  Islamic university,kushtia;     .   *
  *   .  zitulmahmud88@gmail.com;        .   *
  *   .  "stay hungry stay foolish"      .   *
  *   . . . . . . . . . . . . . . . . . ..   *
  ********************************************/
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;

///Predefined
#define pi acos(-1)                    //define pi value
#define mod 1000000007                 //modulo value
#define ll long long int               //define long long int
#define s_size 1001                    //define array_small_size
#define l_size 100100                  //define array_large_size
#define str_size 100005                //define string_size

int main()
{
    int n,ara[101],i;
    cin>>n;
    for(i=0;i<n;i++) cin>>ara[i];
    if(n==1)
    {
        if(ara[0]<15&&ara[0]>0)
        {
            cout<<-1<<endl;
            return 0;
        }
        else if(ara[0]==15)
        {
            cout<<"DOWN"<<endl;
            return 0;
        }
        else if(ara[0]==0)
        {
            cout<<"UP"<<endl;
            return 0;
        }
    }
    else if(ara[n-2]>ara[n-1])
    {
            cout<<"DOWN"<<endl;
            return 0;
    }
    else if(ara[n-2]<ara[n-1])
    {
            cout<<"UP"<<endl;
            return 0;
    }
    return 0;
}

#include <iostream>
using namespace std;

int main()
{
	int n, a, flag = 0;
	cin >> n;
	int array[100];
	for (int i = 0; i<n; i++)
	{
		cin >> a;
		array[i] = a;
	}

	for (int z = 0; z<n - 1; z++)
	{
		if (array[z]<array[z + 1] && array[n-1] != 15)
			flag = 1;
		else if (array[z]>array[z + 1] || array[n - 1] == 15)
			flag = 2;
		else
			flag = 0;
	}

	if (flag == 1 )
		cout << "UP" << endl;
	else if (flag == 2)
		cout << "DOWN" << endl;
	else
		cout << -1 << endl;
    return 0;
}

#include<iostream>

using namespace std;

int main()
{
	int num, count1=0, count2=0;
	bool moon=true;
	cin>>num;

        if(num==1)
        cout<<"-1";

	int day[15];
	for(int i=0; i<num; i++)
		cin>>day[i];
	for(int i=0; i<num; i++)
	{
		if(day[i] == 15)
		{
		moon = false;
		break;
		}

		if(day[i] == day[i+1])
	{
		cout<<"-1";
		break;
	}

	}

	if(moon == true)
{
	if(day[num-1] > day[num-2])
		moon = true;
		else
		moon = false;
}
	if(moon == false)
		cout<<"DOWN";
	else
		cout<<"UP";

	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#define Abo_Okail ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <stack>
#include <vector>
#include<map>
using namespace std;
int main()
{
	Abo_Okail;

	int n, arr[100], x;

	cin >> n;

	for (int i = 0; i < n; i++)
		cin >> arr[i];

	if(arr[0] == 15 && n == 1)
	{
		cout << "DOWN" << "\n";
		return 0;
	}

	if(n == 1)
	{
		cout << -1 << "\n";
		return 0;
	}

	if(arr[n - 1] > arr[n - 2])
	{
		if(arr[n - 1] == 15)
			x = arr[n - 1] - 1;
		else
			x = arr[n - 1] + 1;

		(x > arr[n - 1]) ? cout << "UP" << "\n" : cout << "DOWN" << "\n";
	}
	else
	{
		cout << "DOWN" << "\n";
	}

	return 0;
}

#include <iostream>
#include<algorithm>
using namespace std;
int main() {
    int n;
    cin>>n;
    int arr[n];
    for(int k=0;k<n;k++){
      cin>>arr[k];
    }
    if(arr[n-1]==15){
          if(arr[n-1]>arr[n-2]&&arr[n-2]>arr[n-3]){
            cout<<"DOWN";
          }
          else if (arr[n-1]<arr[n-2]&&arr[n-2]<arr[n-3]){cout<<"UP";}
          else{cout<<"DOWN";}

        }
    else{
        if(n>1){

        if(arr[n-1]>arr[n-2]){
           cout<<"UP";}
        else if(arr[n-2]>arr[n-1]){cout<<"DOWN";}
    }
    else{cout<<-1;}

    }

}

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n;
    int a[n+1];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    if(a[n]==0)
        cout<<"UP";
    else if(a[n]==15)
        cout<<"DOWN";
    else if(n==1)
        cout<<"-1";
    else
    {
        if(a[n-1]<a[n])
            cout<<"UP";
        else
            cout<<"DOWN";
    }
    return 0;
}

#include <iostream>
#include<cmath>
#include<sstream>
#include<cctype>
using namespace std;

int main()
{
    int  sgu =0;
	int t;
	cin>>t;
	int r;
	int *s =new int[t];

	for	(int i=0;i<t;i++)
	{ cin>>s[i];}

	for(r=0;r<t-1;r++)
	{

		if(s[r]<s[r+1] || s[r]==0)
	   {sgu=1;}
		else
			if(s[r]>s[r+1] || s[r]==15)
				sgu=2;
			else
	           sgu=0;
	}
	if(sgu == 1 ||s[0]==0 )
	{cout<<"UP";}
	else
		if(sgu==2 )
		{cout<<"DOWN";}
		else
			cout<<"-1";
	delete []s;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
int main()
{
    int n, ar[100];
    cin>>n;
    int i;
    for(i=1; i<=n; i++){
        scanf("%d",&ar[i]);
    }
    if(n==1 && ar[n]!=0) printf("-1\n");
    else if(ar[n]==0 || ar[n]==1) printf("UP\n");
    else if(ar[n-1]<ar[n]) printf("UP\n");
    else printf("DOWN\n");
    return 0;
}

#include <iostream>
#include <cstdio>
using namespace std;
main()
{
	long n,i,k,a[100];
	cin >> n;
	for(i = 1;i <=n;i++)
	{
		cin >> a[i];
	}
	if(n == 1)
		cout << -1;
	else if(a[n] > a[n - 1] && a[n] != 15)
	cout << "UP";
	else cout << "DOWN";
return 0;}

#define ll              long long
#define ull             unsigned long long
#define pb              push_back
#define SIZE(a)         (int)a.size()
#define SORT(v)         sort(v.begin(),v.end())
#define RSORT(v)        sort(v.rbegin(),v.rend())
#define REV(v)          reverse(v.begin(),v.end())
#define ff              first
#define ss              second
#define sq(a)           ((a)*(a))
#define For(i,a,b)      for(i=a;i<=b;i++)
#define RFor(i,a,b)      for(i=a;i>=b;i--)
#define Rep(i,b)        for(i=0;i<b;i++)
#define MOD             1000000007
#define PI              acos(-1.0)
#define eps             1e-9
#define Linf            2e18
#define inf             1<<30
#define MX5             100005
#define MX6             1000006
#define MX3             1005
#define GCD(a,b)	    __gcd(a,b)
#define sc2(a,b)	        scanf("%lld%lld",&a,&b)
#define sc1(a)		    scanf("%lld",&a)
#define print(a)	    printf("%lld\n",a);
#define mem(a)          memset(a,-1,sizeof(a))
#define clr(a)           memset(a,0,sizeof (a))
#define mk               make_pair
#define pLL              pair<ll,ll>
#define ff               first
#define ss               second
#define invcos(a)	    (acos(a)*(180/3.14159265))
#define rtan(a)          (tan(a*3.14159265/180.0))
#include <bits/stdc++.h>
#define  fast              ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;

ll bigmod(ll n,ll p){if(p==0) return 1;if(p==1)return (n+MOD)%MOD;if(p%2)return (bigmod(n,p-1)*n+MOD)%MOD;else{ll x=bigmod(n,p/2);return (x*x+MOD)%MOD;}}
ll modinverse(ll n){return bigmod(n,MOD-2)%MOD;}
int main(){
    ll a,b,i,c,d;cin>>a;c=a;
    vector<ll>v;
    while(a--){
            cin>>b;v.pb(b);}
            if(c==1){cout<<"-1"<<endl;return 0;}d=0;
    if(v[v.size()-1]-v[v.size()-2]<=0)d=1;
    d==1?cout<<"DOWN"<<endl:cout<<"UP"<<endl;

}

#include<bits/stdc++.h>
using namespace std;
int ara[100];
int main()
{
    int n,a,cnt=0,l=0,m=0,m1=0,k=0;
    cin>>n;
    for(int i=1; i<=n; i++){
       cin>>a;
       ara[a]++;
       if(i == n){
        m = a;
       }
       if(i == n-1){
        m1 = a;
       }
    }
     if(m1<m || m==1){

        cout<<"UP"<<endl;
        return 0;
    }
    if(n==1 || m== m1){
        cout<<"-1"<<endl;
        return 0;
    }
    else{
        cout<<"DOWN"<<endl;
    }

}

#include<iostream>
using namespace std;
int main() {
	int n,m=0;
	cin >> n;
	int arr[100] = {};
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}

	if (n == 1) {
		cout << -1;
	}
	else if (arr[n-2]>arr[n-1]) {
		cout << "DOWN ";
	}
	else {
		cout << "UP ";
	}

	return 0;
}

#include <iostream>

using namespace std;

int main()
{
	bool chek = true;

	int n;

	cin >> n;

	int *arr;

	arr = new int[n];

	if (n == 1)
	{
		cin >> arr[0];
		cout << -1;
	}
	else
	{
		for (int i = 0; i < n; i++)
		{
			cin >> arr[i];
		}

		if (arr[n - 2] > arr[n - 1])
		{
			chek = false;
		}

		if (chek)
		{
			cout << "UP";
		}
		else cout << "DOWN";
	}

}