#include<bits/stdc++.h>
using namespace std;
#define int long long
#define For(i,a,b) for(register int i=a;i<=b;++i)
#define Down(i,a,b) for(register int i=a;i>=b;i--)
#define reg register
inline int min(int x,int y){return x<y?x:y;}
inline int max(int x,int y){return x>y?x:y;}
inline void swap(int &x,int &y){int t=x; x=y; y=t; return ;}
namespace yspm{
	inline int read(){
		int res=0,f=1; char k;
		while(!isdigit(k=getchar())) if(k=='-') f=-1;
		while(isdigit(k)) res=res*10+k-'0',k=getchar();
		return res*f;
	}
	int mod;
	int p[10]={1,1,4,4,2,1,1,4,4,2};
	int bas[10]={0,1,6,1,6,5,6,1,6,1};
	inline int ksm(int x,int y){
		int res=1%mod; x%=mod; for(;y;y>>=1,x=x*x%mod) if(y&1) res=res*x%mod;
		return res;
	} 
	signed main(){
		int a=read()%10,b=read(),c=read(); 
		mod=p[a]; int ans=bas[a]; 
		int res=ksm(b,c); 
		for(reg int i=1;i<=res;++i) ans=ans*a%10;
		cout<<ans<<endl;
		return 0;
	}
}
signed main(){return yspm::main();}

#include <bits/stdc++.h> 
using namespace std;

template <class T>
inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;}
#define REP(i, s, e) for (int i = s; i < e; i++)
#define RREP(i, s, e) for (int i = s; i >= e; i--)
typedef long long ll;
typedef long double ld;
#define MP make_pair
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
#define MT make_tuple
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define pb emplace_back
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

#define INF 1000000005
#define LINF 1000000000000000005
#define MOD 1000000007
#define MAXN 400005

int n;
int a[MAXN];
priority_queue<ii> pq;
char type[2];
bool impt[MAXN];
string ans;

int main() {
	scanf("%d", &n);
	REP (i, 0, n * 2) {
		scanf("%d", &a[i]);
		pq.push(MP(a[i], i));
	}
	REP (i, 0, n) {
		auto [_, id] = pq.top(); pq.pop();
		impt[id] = 1;
	}
	int cnt = 0;
	REP (i, 0, n * 2) {
		if (cnt == 0) {
			type[impt[i]] = '(';
			type[1 - impt[i]] = ')';
		}
		ans += type[impt[i]];
		if (type[impt[i]] == '(') {
			cnt++;
		} else {
			cnt--;
		}
	}
	printf("%s\n", ans.c_str());
	return 0;
}
