#include <bits/stdc++.h>
#define faster ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ff first
#define ss second
using namespace std;

void file()
{
    freopen ( "CHUYEN.inp", "r", stdin );
    freopen ( "CHUYEN.out", "w", stdout );
}

typedef pair<int, int> ii;

const int maxn = 1e2 + 7;

int n, m;
vector<ii> ds;
vector<vector<int>> dsk;

int mau[maxn];
int c[maxn];
int e[maxn][maxn];

void dfs ( int u )
{
    mau[u] = 1;
    for ( int v : dsk[u] )
    {
        if ( ( c[u] > c[v] || c[u] == c[v] ) && !e[u][v] && !e[v][u] )
            e[u][v] = 1, dfs ( v );
    }

}

void solve()
{
    for ( int i = 1; i <= n; ++i )
        if ( mau[i] == 0 )
            dfs ( i );
    for ( int i = 0; i < ds.size(); ++i )
    {
        int u, v;
        u = ds[i].ff;
        v = ds[i].ss;
        if ( e[u][v] )
            cout << "->";
        else
            cout << "<-";

        cout << '\n';
    }

}

void input()
{
    cin >> n >> m;
    dsk.assign ( n + 1, vector<int>() );
    for ( int i = 1; i <= m; ++i )
    {
        int u, v;
        cin >> u >> v;
        ds.push_back ( {u, v} );
        dsk[u].push_back ( v );
        dsk[v].push_back ( u );
    }
    for ( int i = 1; i <= n; ++i )
        cin >> c[i];
}

signed main()
{
    faster;
    //file();
    input();
    solve();
}

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
template <class T>
using Vec2 = vector<vector<T>>;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define REPN(i, m, n) for(ll i = (m); i <= (n); ++i)
#define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i)
#define REPNR(i, m, n) for(ll i = (m); i >= (n); --i)
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
template <class T1, class T2>
bool chmax(T1 &a, const T2 b) { if (a < b) { a = b; return true; } return false; }
template <class T1, class T2>
bool chmin(T1 &a, const T2 b) { if (a > b) { a = b; return true; } return false; }
template <class T>
istream &operator>>(istream &is, vector<T> &v) { for (T &i : v) is >> i; return is; }
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &i : v) os << i << ' '; return os; }
void _co() { cout << '\n'; }
template <class Head, class... Tail>
void _co(Head&& head, Tail&&... tail) { cout << ' ' << head; _co(forward<Tail>(tail)...); }
template <class Head, class... Tail>
void co(Head&& head, Tail&&... tail) { cout << head; _co(forward<Tail>(tail)...); }
void ce() { cerr << '\n'; }
template <class Head, class... Tail>
void ce(Head&& head, Tail&&... tail) { cerr << head << ' '; ce(forward<Tail>(tail)...); }
void sonic() { ios::sync_with_stdio(false); cin.tie(nullptr); }
void setp(const int n) { cout << fixed << setprecision(n); }
constexpr int64_t LINF = 1000000000000000001;
constexpr int64_t MOD = 1000000007;
constexpr int64_t MOD_N = 998244353;
constexpr long double EPS = 1e-11;
const double PI = acos(-1);

Vec ans;
Vec a, b;

template <class T>
struct Graph {
    struct edge {
        int64_t from, to;
        T dist;

        bool operator<(const edge &rhs) const { return dist < rhs.dist; }

        bool operator>(const edge &rhs) const { return dist > rhs.dist; }

        edge &operator+=(const edge &rhs) {
            to = rhs.to;
            dist += rhs.dist;
            return *this;
        }
        edge operator+(const edge &rhs) { return edge(*this) += rhs; }
    };

    int64_t V;
    vector<T> dist;
    vector<vector<edge>> edges;
    bitset<100000> is_visited;

    Graph(int64_t v) : V(v) {
        edges = vector<vector<edge>>(V);
        dist = vector<T>(V, numeric_limits<T>::max());
    }

    void add_edge(int64_t a, int64_t b, T d = 1, bool is_dual = false) {
        edges[a].push_back(edge{a, b, d});
        if (is_dual) edges[b].push_back(edge{b, a, d});
    }

    void dfs(ll v, ll p, T c) {
        // ce(v, p, c);
        if (c != -1) {
            if (is_visited[c])
                return;
            is_visited[c] = true;
            if (v == b[c])
                ans[c] = 1;
            else
                ans[c] = 2;
        }
        // ce("ok", v, p, c);
        for (auto e : edges[v]) {
            if (e.to == p)
                continue;
            dfs(e.to, v, e.dist);
        }
    }
};

int main(void) {
    ll n, m;
    cin >> n >> m;
    a.resize(m);
    b.resize(m);
    rep(i, m) cin >> a[i] >> b[i];
    Vec c(n);
    cin >> c;
    Graph<ll> g(n);

    ans.resize(m);
    rep(i, m) a[i]--, b[i]--;
    rep(i, m) {
        if(c[a[i]] > c[b[i]])
            ans[i] = 1;
        else if (c[a[i]] < c[b[i]])
            ans[i] = 2;
        else
            g.add_edge(a[i], b[i], i, true);
    }

    rep(i, n) g.dfs(i, i, -1);

    rep(i, m) {
        if (ans[i] == 1)
            co("->");
        else
            co("<-");
    }

    return 0;
}