Problem: A balancing network is an abstract device built up of N wires, thought of as running from left to right, and M balancers that connect pairs of wires. The wires are numbered from 1 to N from top to bottom, and the balancers are numbered from 1 to M from left to right. Balancer i connects wires x_i and y_i (x_i < y_i).

pic1-small-2acea94b.png

Each balancer must be in one of two states: up or down.

Consider a token that starts moving to the right along some wire at a point to the left of all balancers. During the process, the token passes through each balancer exactly once. Whenever the token encounters balancer i, the following happens:

* If the token is moving along wire x_i and balancer i is in the down state, the token moves down to wire y_i and continues moving to the right.
* If the token is moving along wire y_i and balancer i is in the up state, the token moves up to wire x_i and continues moving to the right.
* Otherwise, the token doesn't change the wire it's moving along.



Let a state of the balancing network be a string of length M, describing the states of all balancers. The i-th character is `^` if balancer i is in the up state, and `v` if balancer i is in the down state.

A state of the balancing network is called uniforming if a wire w exists such that, regardless of the starting wire, the token will always end up at wire w and run to infinity along it. Any other state is called non-uniforming.

You are given an integer T (1 \le T \le 2). Answer the following question:

* If T = 1, find any uniforming state of the network or determine that it doesn't exist.
* If T = 2, find any non-uniforming state of the network or determine that it doesn't exist.



Note that if you answer just one kind of questions correctly, you can get partial score.

Constraints

* 2 \leq N \leq 50000
* 1 \leq M \leq 100000
* 1 \leq T \leq 2
* 1 \leq x_i < y_i \leq N
* All input values are integers.

Input

Input is given from Standard Input in the following format:


N M T
x_1 y_1
x_2 y_2
:
x_M y_M


Output

Print any uniforming state of the given network if T = 1, or any non-uniforming state if T = 2. If the required state doesn't exist, output `-1`.

Examples

Input

4 5 1
1 3
2 4
1 2
3 4
2 3


Output

^^^^^


Input

4 5 2
1 3
2 4
1 2
3 4
2 3


Output

v^^^^


Input

3 1 1
1 2


Output

-1


Input

2 1 2
1 2


Output

-1

Solution (in CPP):

Solution:
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

/////////////         UnionFind
//    バラバラの要素を結合してグループにまとめる際に使える構造。
//    グループ番号、要素数の取得が可能だが、グループに属する要素の列挙はO(N)かかる。

class UnionFindClass {
public:
	UnionFindClass() {
		N = 0;
		parent = NULL;
		size = NULL;
	}
	~UnionFindClass() {
		if (parent != NULL) {
			delete[] parent;
		}
		if (size != NULL) {
			delete[] size;
		}
	}

	void activate(int n) {// 要素の数N
		N = n;
		parent = new int[N];
		size = new int[N];
		for (int i = 0; i < N; i++) {
			parent[i] = -1;
			size[i] = 1;
		}
	}

	int getParent(int x) {// グループの親の番号を得る
		if (parent[x] == -1) {
			return x;
		}
		else {
			int y = getParent(parent[x]);
			parent[x] = y;
			return y;
		}
	}
	int getSize(int x) {// 自分が属するグループのサイズを得る
		x = getParent(x);
		return size[x];
	}
	bool connect(int x, int y) {// 二つの要素を結ぶ。２グループ間を繋いだ場合trueを返す
		x = getParent(x);
		y = getParent(y);
		if (x == y) { return false; }
		int xsize = getSize(x), ysize = getSize(y);
		if (xsize < ysize) {
			parent[x] = y;
			size[y] += size[x];
			size[x] = 0;
		}
		else {
			parent[y] = x;
			size[x] += size[y];
			size[y] = 0;
		}
		return true;
	}

	//データ
	int N;// 個数
	int* parent;// 親の番号。自分自身が親なら-1。
	int* size;// 親のみ有効。自分のグループのサイズ。
};

int main() {
	int N, M, T; cin >> N >> M >> T;

	if (T == 1) {
		vector<pair<int, int>> v;
		string S;
		bitset<50000>* bset = new bitset<50000>[N];
		for (int i = 0; i < N; i++) {
			bset[i] = 0;
			bset[i][i] = true;
		}
		for (int i = 0; i < M; i++) {
			int x, y; cin >> x >> y;
			x--; y--;
			v.push_back({ x,y });
			S.push_back('^');
		}
		for (int i = M - 1; i >= 0; i--) {
			int x = v[i].first, y = v[i].second;
			bitset<50000> buf = bset[x] | bset[y];
			bset[x] = buf;
			bset[y] = buf;
		}
		bitset<50000> buf = bset[0];
		for (int i = 0; i < N; i++) {
			buf &= bset[i];
		}
		int k = -1;
		for (int i = 0; i < N; i++) {
			if (buf[i] == true) { k = i; }
		}
		if (k == -1) {
			cout << -1 << endl;
		}
		else {
			bool* flags = new bool[N];
			for (int i = 0; i < N; i++) {
				flags[i] = (i == k);
			}
			for (int i = M - 1; i >= 0; i--) {
				int x = v[i].first, y = v[i].second;
				if (flags[x] == true) {
					flags[y] = true;
				}
				else if (flags[y] == true) {
					S[i] = 'v';
					flags[x] = true;
				}
			}
			cout << S << endl;
		}
	}
	else {
		vector<pair<int, int>> v;
		string S;

		for (int i = 0; i < M; i++) {
			int x, y; cin >> x >> y;
			x--; y--;
			v.push_back({ x,y });
			S.push_back('^');
		}
		
		if (N <= 2) { cout << -1 << endl; return 0; }

		int* B = new int[N];
		int* num = new int[N];
		for (int i = 0; i < N; i++) {
			B[i] = i;
			num[i] = 1;
		}
		
		for (int i = M - 1; i >= 0; i--) {
			int x = v[i].first, y = v[i].second;
			if (num[B[x]] > num[B[y]]) {
				num[B[x]]--;
				num[B[y]]++;
				B[x] = B[y];
				S[i] = 'v';
			}
			else {
				num[B[x]]++;
				num[B[y]]--;
				B[y] = B[x];
				S[i] = '^';
			}
		}
		cout << S << endl;
	}
	
	return 0;
}