#include using namespace std; #define rep(i, a, n) for (int i=(a); i < (n); i++) #define per(i, a, n) for (int i=(n)-1; i >= (a); i--) #define ll long long unordered_map fm = {{'>', 'v'}, {'v', '>'}, {'<', '^'}, {'^', '<'}, {'|', '-'}, {'-', '|'}, {'\\', '\\'}, {'/', '/'}}; unordered_map hm = {{'>', '<'}, {'v', 'v'}, {'<', '>'}, {'^', '^'}, {'|', '|'}, {'-', '-'}, {'\\', '/'}, {'/', '\\'}}; unordered_map vm = {{'>', '>'}, {'v', '^'}, {'<', '<'}, {'^', 'v'}, {'|', '|'}, {'-', '-'}, {'\\', '/'}, {'/', '\\'}}; unordered_map trans = {{'<',5},{'>',6},{'/',7},{'\\',4},{'|',2},{'-',1}}; char flip(char c, int st){ if(c=='x'||c=='o') return c; if(st&4)c = fm[c]; if(st&2) c = hm[c]; if(st&1) c = vm[c]; return c; } void flipState(int &x) { x = (x&4) + ((x&1)<<1)+((x&2)>>1); } int main(void) { int n; while(cin>>n){ vector a(n); rep(i,0,n)cin>>a[i]; string cmd; getline(cin,cmd); getline(cin,cmd); int st = 0; for(int i = 0; i < cmd.size(); i+=2){ int cur = trans[cmd[i]]; if(cur&4) flipState(st), st ^= 4; //if(st&4) flipState(cur); st ^= cur & 3; //cout< res(n,string(n, '_')); rep(x,0,n)rep(y,0,n){ int tx = x, ty = y; if(st & 4) swap(tx, ty); if(st & 2) tx = n - 1 - tx; if(st & 1) ty = n - 1 - ty; res[ty][tx] = flip(a[y][x], st); } rep(y,0,n) cout<