#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define ET cout << "\n"
#define SZ(a) ((int)a.size())
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#ifdef bbq
#define debug(...) {\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}
#define DB(a,s,e) {for(int _i=s;_i<e;++_i) cerr << a[_i] << " ";cerr << "\n";}
template<typename T>void _do(T &&x){cerr<<x<<endl;}
template<typename T,typename ...S> void _do(T &&x,S &&...t){cerr<<x<<", ";_do(t...);}
template<typename a,typename b> ostream& operator << (ostream &s,const pair<a,b> &p){return s<<"("<<p.X<<","<<p.Y<<")";}
#else
#define debug(...)
#define DB(a,s,e)
#endif

pii edge[20000];
int c[20000], dir[20000], boss[20000], vis[20000], dft;
vector<int> G[20000];

void dfs(int u, int f) {
    vis[u] = ++dft;
    for (int i : G[u]) {
        if (i == f) continue;
        int type, v;
        if (edge[i].X == u)
            type = 1, v = edge[i].Y;
        else
            type = 2, v = edge[i].X;
        if (!vis[v]) {
            dir[i] = type;
            dfs(v, i);
        }
        else if (vis[u] > vis[v])
            dir[i] = type;
    }
}

int finds(int x) {
    if (x == boss[x])
        return x;
    return boss[x] = finds(boss[x]);
}

int main() {
    IOS();
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= m; ++i)
        cin >> edge[i].X >> edge[i].Y;
    for (int i = 1; i <= n; ++i)
        cin >> c[i], boss[i] = i;
    for (int i = 1; i <= m; ++i)
        if (c[edge[i].X] == c[edge[i].Y]) {
            boss[finds(edge[i].X)] = finds(edge[i].Y);
            G[edge[i].X].pb(i);
            G[edge[i].Y].pb(i);
        }
        else if (c[edge[i].X] > c[edge[i].Y])
            dir[i] = 1;
        else
            dir[i] = 2;
    for (int i = 1; i <= n; ++i)
        if (!vis[finds(i)])
            dfs(finds(i), 0);
    for (int i = 1; i <= m; ++i)
        if (dir[i] == 1)
            cout << "->\n";
        else if (dir[i] == 2)
            cout << "<-\n";
        else
            assert(0);
}

#include "bits/stdc++.h"
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
#define maxn 10000
#define mod 1000000007
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef double db;

vi to[maxn+5]; 
pii e[maxn+5];
int c[maxn+5];

bool ans[maxn+5];
int dep[maxn+5];

void dfs(int now,int fa)
{
    for(auto i: to[now]) 
    {
        int v=now^e[i].FI^e[i].SE;
        if(c[v]!=c[now] || v==fa) continue;
        if(dep[v]==0)
        {
            if(e[i].FI==now) ans[i]=1;
            dep[v]=dep[now]+1;
            dfs(v,now);
        }
        else if(dep[v]<dep[now])
        {
            if(e[i].FI==now) ans[i]=1;
        }
    }
}

int main()
{
    int n,m; scanf("%d%d",&n,&m);
    rep(i,1,m) scanf("%d%d",&e[i].FI,&e[i].SE),to[e[i].FI].pb(i),to[e[i].SE].pb(i);
    rep(i,1,n) scanf("%d",&c[i]);

    rep(i,1,m) if(c[e[i].FI]>c[e[i].SE]) ans[i]=1;
    rep(i,1,n) if(dep[i]==0) dep[i]=1,dfs(i,0);
    rep(i,1,m) if(ans[i]) puts("->"); else puts("<-");
    return 0;
}