//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Dont keep array name as size or any other key word
//ctrl+end - to break infinite loop in sublime text
 
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
using namespace std; 
#define Fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(nullptr);                 \
    cout.tie(nullptr)
#define ll long long int
#define fo(i, a, b) for (long long int i = a; i <= b; i++)
#define w(t)  \
    int t;    \
    cin >> t; \
    while (t--)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vl vector<long long int>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define mii map<int, int>
#define umii unordered_map<int, int>
#define mll map<ll,ll>
#define umll unordered_map<ll,ll>
#define newl cout<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll inf = 1e9+7;
const ll mod = 998244353 ;
#define MAX 200005 

void call_priyanshu(){
    Fio;
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

ll mini(ll a,ll b){
    if(a>=b)return b;
    return a;
}
 
ll maxi(ll a,ll b){
    if(a>=b)return a;
    return b;
}

void run(ll n,ll d1,ll d2,ll d3,ll d4,ll d5,ll d6,vector<pair<ll,ll>> &A,vector<pair<ll,ll>> &B){
    if(d1>=d2){
        if((B[0]==A[0] && B[n-1]==A[n-1]) || (B[n-1]==A[0] && B[0]==A[n-1])){
            cout<<max(max(d3,d4),max(d5,d6));
            return;
        }else{
            cout<<max(d2,max(d3,d4));
            return;
        }
    }else{
        if((B[0]==A[0] && B[n-1]==A[n-1]) || (B[n-1]==A[0] && B[0]==A[n-1])){
            cout<<max(max(d3,d4),max(d5,d6));
            return;
        }else{
            cout<<max(d1,max(d5,d6));
            return;
        }
    }
}

void calc(vector<pair<ll,ll>> &A,vector<pair<ll,ll>> &B,ll n){
    ll v1 = abs(A[0].first - A[n-1].first);
    ll v2 = abs(B[0].first - B[n-1].first);
    ll v3 = abs(A[0].first - A[n-2].first);
    ll v4 = abs(A[1].first - A[n-1].first);
    ll v5 = abs(B[0].first - B[n-2].first);
    ll v6 = abs(B[1].first - B[n-1].first);
    run(n,v1,v2,v3,v4,v5,v6,A,B);
}

void solve(){
    //write your code here
    ll n;
    cin>>n;
    vector<pair<ll,ll>> A,B;
    for(ll i = 0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        A.pb(mp(x,y));
        B.pb(mp(y,x));
    }
    sort(all(A)),sort(all(B));
    calc(A,B,n);

    
}


int main(){
    call_priyanshu();
    // w(T){
        solve();
    // }
    return 0;
}
#include<bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#ifndef LOCAL
#define cerr if(0)cerr
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using pii = pair<int, int>;

const int MAXN = 101, MAXM = MAXN*MAXN;
int n, m, c[MAXN], a[MAXM], b[MAXM], dep[MAXN];
bool direc[MAXN][MAXN];
bool vis[MAXN];
vector<int> g[MAXN];
void dfs(int x, int prv) {
	vis[x] = 1;
	dep[x] = dep[prv]+1;
	for(int i: g[x]) {
		if(!vis[i]) {
			direc[x][i] = 1;
			dfs(i, x);
		}
	}
	for(int i: g[x]) {
		if(i!=prv && dep[i]<dep[x]) {
			direc[x][i] = 1;
		}
	}
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n>>m;
	for(int i=0; i<m; ++i) {
		cin>>a[i]>>b[i];
		
	}
	for(int i=1; i<=n; ++i) {
		cin>>c[i];
	}
	for(int i=0; i<m; ++i) {
		if(c[a[i]] > c[b[i]]) {
			direc[a[i]][b[i]] = 1;
		}
		if(c[b[i]] > c[a[i]]) {
			direc[b[i]][a[i]] = 1;
		}
		if(c[a[i]]==c[b[i]]) {
			g[a[i]].push_back(b[i]);
			g[b[i]].push_back(a[i]);
		}
	}
	for(int i=1; i<=n; ++i) {
		if(!vis[i]) {
			dfs(i, i);
		}
	}
	for(int i=0; i<m; ++i) {
		if(direc[a[i]][b[i]]) cout<<"->\n";
		else cout<<"<-\n";
	}
}

