//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
//Incase of close mle change language to c++17 or c++14 

#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
//#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007ll //998244353ll
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second 
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)    
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) for(int i=0;i<=n;i++){for(int j=0;j<=m;j++)cout<<dp[i][j]<<" ";cout<<"\n";}
typedef std::numeric_limits< double > dbl;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const long long N=10005, INF=2000000000000000000;
lld pi=3.1415926535897932;
int lcm(int a, int b)
{
    int g=__gcd(a, b);
    return a/g*b;
}
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }
vector <pii> v[N], ed;
int ans[N];
bool vis[N];
void dfs(int u)
{
    vis[u]=true;
    for(auto p:v[u])
    {
        if(ans[p.ss]==-1)
        {
            if(ed[p.ss].ss==u && !vis[p.ff])
            dfs(p.ff);
        }
        else if(ans[p.ss]==1)
        {
            if(ed[p.ss].ff==u && !vis[p.ff])
            dfs(p.ff);
        }
        else
        {
            if(ed[p.ss].ff==u)
            ans[p.ss]=1;
            else
            ans[p.ss]=-1;
            if(!vis[p.ff])
            dfs(p.ff);
        }
    }
}
int32_t main()
{
    IOS;
    fill(vis, false);
    int n, m;
    cin>>n>>m;
    fill(ans, 0);
    rep(i,0,m)
    {
        int a, b;
        cin>>a>>b;
        v[a].pb({b, i});
        v[b].pb({a, i});
        ed.pb({a, b});
    }
    int c[n+1];
    rep(i,1,n+1)
    cin>>c[i];
    rep(i,0,m)
    {
        int a=ed[i].ff, b=ed[i].ss;
        if(c[a]>c[b])
        ans[i]=1;
        else if(c[a]<c[b])
        ans[i]=-1;
    }
    rep(i,1,n+1)
    {
        if(!vis[i])
        dfs(i);
    }
    rep(i,0,m)
    {
        if(ans[i]==1)
        cout<<"->\n";
        else
        cout<<"<-\n";
    }
}
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define eps 1e-8
//#define eq(x,y) (fabs((x)-(y)) < eps)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const int mod= 1e9+7;
long double pi = acosl(-1);
//const ll infl = LLONG_MAX;
const int inf = 1e9+2;
const int nmax = 1e5+5;
//const int MAXLG = log2(nmax)+1;
//mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;

int n,m;
int ans[nmax]; /// +1 for -> , -1 for <-
bool vis[nmax];
pii c[nmax];
int cval[nmax];

struct ejj{
    int v, val, idx;
};

vector<ejj>g[nmax];

void dfs(int u){
    vis[u] = true;
    for(ejj e : g[u]){
        int v = e.v;
        if(cval[v]>cval[u]){
            ans[ e.idx ] = e.val*-1;
        }
        else if(cval[v]==cval[u] and !vis[v]){
            ans[ e.idx ] = e.val;
            dfs(v);
        }
        else if(cval[v]==cval[u]){
            ans[ e.idx ] = e.val;
        }
        else if(cval[v]<cval[u]){
            if(!ans[e.idx])
                ans[ e.idx ] = e.val;
        }
    }
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    cin>>n>>m;
    for(int i=1; i<=m; i++){
        int a,b;
        cin>>a>>b;
        ejj e;
        e.v = b, e.val = 1, e.idx = i;
        g[a].emplace_back( e );
        e.v = a, e.val = -1;
        g[b].emplace_back( e );
    }
    for(int i=1; i<=n; i++){
        cin>>c[i].first;
        cval[i] = c[i].first;
        c[i].second = i;
    }
    sort(c+1, c+1+n);
    for(int i=1; i<=n; i++){
        int u = c[i].second;
        if(!vis[u]){
            dfs(u);
        }
    }
    for(int i=1; i<=m; i++){
        if(ans[i]>0) cout<<"->\n";
        else cout<<"<-\n";
        assert(ans[i]!=0);
    }
}
/*
*/
