#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int, int> >
#define vpll vector <pair <long long, long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define vb vector <bool>
#define vvb vector <vb>
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MANX MAXN
#define itn int
#define dbg(x); {cout << #x << "=" << x << ", ";}
#define in(x); { for (auto &to : x) cin >> to;}
#define out(x); { for (auto &to : x) cout << to << " "; cout << '\n'; }

const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const int mod1 = 1e9+7;
const int mod2 = 1e9+21;
int a,b;

void solve()
{
    cin>>a>>b;
    int x=a+b;
    if (x>=15&&b>=8)
        cout<<1;
    else if (x>=10&&b>=3)
        cout<<2;
    else if (x>=3)
        cout<<3;
    else
        cout<<4;
}

int main() {
    #ifdef Mip182
    freopen("a.in", "r", stdin);
    #else
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #endif
    int _t;
    _t=1;
//    cin>>_t;
    while (_t--)
        solve();
    #ifdef Mip182
    cout<<'\n'<<"Time : "<<(double)(clock())/CLOCKS_PER_SEC<<'\n';
    #endif
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const int N = 101010;
int n, m;
int ed[N][2];
vector<int> g[N];
int c[N];
int ans[N];
bool used[N];

int getOther(int id, int v) {
	return ed[id][0] ^ ed[id][1] ^ v;
}

void dfs(int v) {
	used[v] = 1;
	for (int id : g[v]) {
		int u = getOther(id, v);
		if (used[u]) {
			if (ans[id] == -1)
				ans[id] = (int)(ed[id][1] == v);
		} else {
			ans[id] = (int)(ed[id][1] == v);
			dfs(u);
		}
	}
}

int main()
{
	startTime = clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++) {
		ans[i] = -1;
		for (int j = 0; j < 2; j++) {
			scanf("%d", &ed[i][j]);
			ed[i][j]--;
		}
	}
	for (int i = 0; i < n; i++)
		scanf("%d", &c[i]);
	for (int i = 0; i < m; i++) {
		int v = ed[i][0], u = ed[i][1];
		if (c[v] != c[u]) {
			if (c[v] > c[u])
				ans[i] = 0;
			else
				ans[i] = 1;
		} else {
			g[v].push_back(i);
			g[u].push_back(i);
		}
	}
	for (int i = 0; i < n; i++) {
		if (used[i]) continue;
		dfs(i);
	}
	for (int i = 0; i < m; i++) {
		if (ans[i] == 0)
			printf("->\n");
		else
			printf("<-\n");
	}

	return 0;
}
