#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int n, q;

int pos1 =  1;
int pos2 = 2;

int getpos(int cur, int ahd) {
	// cout <<cur <<"**"<<ahd<<endl;
	if (ahd > 0) {
		cur = cur + 2 *  ahd;
		if (cur > n)  cur = cur - n;
	}
	if (ahd <  0) {
		cur = cur -  2 *  ahd;
		if (cur <= 0)  cur = cur + n;
	}
	return cur;
}
int main ()
{
	cin >> n >> q;
	int hlf = n/2;
	for (int i = 1; i <= q; i++) {
		int tp;
		cin >> tp;
		if (tp == 2) {
			swap(pos1, pos2);
		}
		else {
			int x;
			cin >> x;
			if (x > 0) {
				if (x % 2 == 0) {

					pos1 = getpos(pos1, (n - x)/2);
					pos2 = getpos(pos2, (n-x)/2);
				}
				else {
					// cout <<n<<"###"<<x<<endl;
					int  hk = getpos(pos2, (n - x -1)/2);
					int pk  = getpos(pos1, (n - x + 1)/2);
					pos1 = hk;
					pos2 = pk;
				}
				// cout <<pos1 <<" "<<pos2<<endl;
				// return 0;
			}
			else {
				x = -x;
				if (x % 2 == 0) {
					pos1 = getpos(pos1, x/2);
					pos2 = getpos(pos2, x/2);
				}
				else {
					int  hk = getpos(pos2, (x -1)/2);
					int pk  = getpos(pos1, (x +1)/2);
					pos1 = hk;
					pos2 = pk;
				}
			}
		}
	}
	for (int i = 1; i <= n/2; i++) {
		cout <<pos1 <<" "<<pos2<<" ";
		pos1 += 2;
		pos2 += 2;
		if (pos1 > n) pos1 -= n;
		if (pos2 > n) pos2 -= n;
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int ar[20000007];

int main()
{
	int n, q;
	scanf ("%d%d", &n, &q);
	int pos1 = 1;
	int pos2 = 2;
	while (q--) {
		int tp;
		scanf ("%d", &tp);
		if (tp == 2) {
			if (pos1 % 2 == 0) pos1 --;
			else pos1 ++;
			if (pos2 % 2 == 0) pos2 --;
			else pos2 ++;
			if (pos1 > n) pos1 -= n;
			if (pos2 > n) pos2 -= n;
			if (pos1 <= 0) pos1 += n;
			if (pos2 <= 0) pos2 += n;
		}

		else {
			int mv;
			scanf("%d", &mv);
			pos1 = pos1 + mv;
			pos2 = pos2 + mv;
			if (pos1 > n) pos1 -= n;
			if (pos2 > n) pos2 -= n;
			if (pos1 <= 0) pos1 += n;
			if (pos2 <= 0) pos2 += n;
		}
	}
	int v = 1;
	for (int i = pos1; ; i = i + 2) {
		if (i > n) i-=n;
		if (ar[i] != 0) break;
		ar[i] = v;
		v = v + 2;
	}
	v = 2;
	for (int i = pos2; ; i = i + 2) {
		if (i > n) i-=n;
		if (ar[i] != 0) break;
		ar[i] = v;
		v = v + 2;
	}
	for (int i = 1; i <= n; i++) cout <<ar[i]<<" ";
	cout <<endl;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int n, q;

int pos1 =  1;
int pos2 = 2;

int getpos(int cur, int ahd) {
	// cout <<cur <<"**"<<ahd<<endl;
	if (ahd > 0) {
		cur = cur + 2 *  ahd;
		if (cur > n)  cur = cur - n;
	}
	if (ahd <  0) {
		cur = cur -  2 *  ahd;
		if (cur <= 0)  cur = cur + n;
	}
	return cur;
}
int main ()
{
	cin >> n >> q;
	int hlf = n/2;
	for (int i = 1; i <= q; i++) {
		int tp;
		scanf("%d", &tp);
		if (tp == 2) {
			swap(pos1, pos2);
		}
		else {
			int x;
			scanf ("%d", &x);
			if (x > 0) {
				if (x % 2 == 0) {

					pos1 = getpos(pos1, (n - x)/2);
					pos2 = getpos(pos2, (n-x)/2);
				}
				else {
					// cout <<n<<"###"<<x<<endl;
					int  hk = getpos(pos2, (n - x -1)/2);
					int pk  = getpos(pos1, (n - x + 1)/2);
					pos1 = hk;
					pos2 = pk;
				}
				// cout <<pos1 <<" "<<pos2<<endl;
				// return 0;
			}
			else {
				x = -x;
				if (x % 2 == 0) {
					pos1 = getpos(pos1, x/2);
					pos2 = getpos(pos2, x/2);
				}
				else {
					int  hk = getpos(pos2, (x -1)/2);
					int pk  = getpos(pos1, (x +1)/2);
					pos1 = hk;
					pos2 = pk;
				}
			}
		}
	}
	for (int i = 1; i <= n/2; i++) {
		cout <<pos1 <<" "<<pos2<<" ";
		pos1 += 2;
		pos2 += 2;
		if (pos1 > n) pos1 -= n;
		if (pos2 > n) pos2 -= n;
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int ar[2000007];

int main()
{
	int n, q;
	scanf ("%d%d", &n, &q);
	int pos1 = 1;
	int pos2 = 2;
	while (q--) {
		int tp;
		scanf ("%d", &tp);
		if (tp == 2) swap(pos1, pos2);
		else {
			int mv;
			scanf("%d", &mv);
			pos1 = pos1 + mv;
			pos2 = pos2 + mv;
			if (pos1 > n) pos1 -= n;
			if (pos2 > n) pos2 -= n;
			if (pos1 <= 0) pos1 += n;
			if (pos2 <= 0) pos2 += n;
		}
	}
	int v = 1;
	for (int i = pos1; ; i = i + 2) {
		if (i > n) i-=n;
		if (ar[i] != 0) break;
		ar[i] = v;
		v = v + 2;
	}
	v = 2;
	for (int i = pos2; ; i = i + 2) {
		if (i > n) i-=n;
		if (ar[i] != 0) break;
		ar[i] = v;
		v = v + 2;
	}
	for (int i = 1; i <= n; i++) cout <<ar[i]<<" ";
	cout <<endl;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int n, q;

int pos1 =  1;
int pos2 = 2;

int getpos(int cur, int ahd) {
	// cout <<cur <<"**"<<ahd<<endl;
	if (ahd > 0) {
		cur = cur + 2 *  ahd;
		if (cur > n)  cur = cur - n;
	}
	if (ahd <  0) {
		cur = cur -  2 *  ahd;
		if (cur <= 0)  cur = cur + n;
	}
	return cur;
}
int main ()
{
	cin >> n >> q;
	int hlf = n/2;
	for (int i = 1; i <= q; i++) {
		int tp;
		cin >> tp;
		if (tp == 2) {
			swap(pos1, pos2);
		}
		else {
			int x;
			cin >> x;
			if (x > 0) {
				if (x % 2 == 0) {

					pos1 = getpos(pos1, (n - x)/2);
					pos2 = getpos(pos2, (n-x)/2);
				}
				else {
					// cout <<n<<"###"<<x<<endl;
					int  hk = getpos(pos2, (n - x +1)/2);
					int pk  = getpos(pos1, (n - x - 1)/2);
					pos1 = hk;
					pos2 = pk;
				}
				// cout <<pos1 <<" "<<pos2<<endl;
				// return 0;
			}
			else {
				x = -x;
				if (x % 2 == 0) {
					pos1 = getpos(pos1, x/2);
					pos2 = getpos(pos2, x/2);
				}
				else {
					int  hk = getpos(pos2, (x +1)/2);
					int pk  = getpos(pos1, (x -1)/2);
					pos1 = hk;
					pos2 = pk;
				}
			}
		}
	}
	for (int i = 1; i <= n/2; i++) {
		cout <<pos1 <<" "<<pos2<<" ";
		pos1 += 2;
		pos2 += 2;
		if (pos1 > n) pos1 -= n;
		if (pos2 > n) pos2 -= n;
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iterator>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>

#define myDEBUG

#ifdef myDEBUG

#define assert(x) \
	if(!x){\
		cerr<<"\n\nERROR!\tFailed: "<<x;\
		cerr<<"\nLine: "<<__LINE__;\
		cerr<<"\nFile: "<<__FILE__;\
		cerr<<"\nTime: "<<__TIME__;\
		cerr<<"\nDate: "<<__DATE__;\
	}

#define err(x) assert(x)
#define warn(x) assert(x)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

void solveA(){
	long long n;
	cin >> n;
	long long ans = (n / 3)*2;
	n = n % 3;
	cout << ans + (n != 0);

}

void solveB(){
	int n;
	cin >> n;
	int p[n];
	char work;
	int buff;
	for(int i = 0; i < n; ++i){
		cin >> work;
		if(work == '<')p[i] = -1;
		if(work == '>')p[i] = 1;
	}
	for(int i = 0; i < n; ++i){
		cin >> buff;
		p[i] *= buff;
	}
	int pos = 0;
	while(pos >= 0 && pos < n){
		if(p[pos] == 0)break;
		else{
			buff = pos;
			pos += p[pos];
			p[buff] = 0;
		}
	}
	if(pos >= 0 && pos < n)cout << "INFINITE\n";
	else cout << "FINITE\n";
	return;
}

void solveC(){
	int n, m, q;
	cin >> n >> m >> q;
	int dp[n][m];
	int v;
	int x, y, z;
	const int r228 = 2000000000;
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < m; ++j)
			dp[i][j] = r228;

	for(int i = 0; i < q; ++i){
		cin >> v;
		if(v == 3){
			cin >> x >> y >> z;
			--x;
			--y;
			dp[x][y] = z;
		}
		if(v == 2){
			cin >> y;
			--y;
			z = dp[0][y];
			for(int i = 0; i < n - 1; ++i)
				dp[i][y] = dp[i+1][y];
			dp[n-1][y] = z;
		}
		if(v == 1){
			cin >> x;
			--x;
			z = dp[x][0];
			for(int i = 0; i < m - 1; ++i)
				dp[x][i] = dp[x][i+1];
			dp[x][m-1] = z;
		}
	}
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j)
			cout << (dp[i][j] == r228 ? 0 : dp[i][j]) << ' ';
		cout << endl;
	}

}

void solveCc(){
	int n, m, q;
	cin >> n >> m >> q;
	int dp[n][m];
	int v;
	int x, y, z;
	const int r228 = 2000000000;
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < m; ++j)
			dp[i][j] = r228;
	int a[q],b[q],c[q],d[q];
	for(int i = 0; i < q; ++i){
		cin >> a[i];
		if(a[i] == 3){
			cin >> b[i] >> c[i] >> d[i];
			--b[i];
			--c[i];
		}
		else{
			cin >> b[i];
			--b[i];
		}
	}
	for(int i = q - 1; i >= 0; --i){
		v = a[i];
		if(v == 3){
			x = b[i];
			y = c[i];
			z = d[i];
			dp[x][y] = z;
		}
		if(v == 2){
			y = b[i];
			z = dp[n-1][y];
			for(int i = n-1; i >0; --i)
				dp[i][y] = dp[i-1][y];
			dp[0][y] = z;
		}
		if(v == 1){
			x = b[i];
			z = dp[x][m-1];
			for(int i = m-1; i >0; --i)
				dp[x][i] = dp[x][i-1];
			dp[x][0] = z;
		}
	}
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j)
			cout << (dp[i][j] == r228 ? 0 : dp[i][j]) << ' ';
		cout << endl;
	}

}

struct Z{
	int ind;
	int time;
	int val;
	int adres;
};

bool operator<(Z lhs, Z rhs){
	return lhs.time < rhs.time;
}

void solveE(){
	int n;
	cin >> n;
	Z p[n];
	int ans[n];
	for(int i = 0; i < n; ++i){
		cin >> p[i].ind >> p[i].time >> p[i].val;
		ans[i] = -1;
		p[i].adres = i;
	}
	sort(p, p + n);
	multiset <int> s;
	for(int i = 0; i < n; ++i){
		if(p[i].ind == 1){
			s.insert(p[i].val);
		}
		if(p[i].ind == 2){
			s.erase(s.find(p[i].val));
		}
		if(p[i].ind == 3){
			ans[p[i].adres] = s.count(p[i].val);
		}
	}
	for(int i = 0; i < n; ++i)if(ans[i] != -1)cout << ans[i] << endl;
}

void solveD(){
	int n, q;
	//cin >> n >> q;
	scanf("%d%d", &n, &q);
	long long delt1 = 0, delt2 = 0;
	long long x, y, z = 0;
	for(int i = 0; i < q; ++i){
		//cin >> x;
		scanf("%I64d", &x);
		if(x == 2){
			if(z){
				--delt1;
				++delt2;
				z = 0;
			}
			else{
				++delt1;
				--delt2;
				z = 1;
			}
		}
		else{
			//cin >> y;
			scanf("%I64d", &y);
			delt1 += y;
			delt2 += y;
			if(y % 2) z = !z;
		}
	}
	long long ans[n];
	for(long long i = 1; i <= n; ++i){
		ans[((i + ((i%2)?delt1:delt2))%n - 1+n)%n] = i;
	}
	for(long long i = 0; i < n; ++i)printf("%I64d ",((int)ans[i]));//cout << ans[i] << ' ';
	printf("\n");
}

int main(){
	solveD();
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iterator>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>

#define myDEBUG

#ifdef myDEBUG

#define assert(x) \
	if(!x){\
		cerr<<"\n\nERROR!\tFailed: "<<x;\
		cerr<<"\nLine: "<<__LINE__;\
		cerr<<"\nFile: "<<__FILE__;\
		cerr<<"\nTime: "<<__TIME__;\
		cerr<<"\nDate: "<<__DATE__;\
	}

#define err(x) assert(x)
#define warn(x) assert(x)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

void solveA(){
	long long n;
	cin >> n;
	long long ans = (n / 3)*2;
	n = n % 3;
	cout << ans + (n != 0);

}

void solveB(){
	int n;
	cin >> n;
	int p[n];
	char work;
	int buff;
	for(int i = 0; i < n; ++i){
		cin >> work;
		if(work == '<')p[i] = -1;
		if(work == '>')p[i] = 1;
	}
	for(int i = 0; i < n; ++i){
		cin >> buff;
		p[i] *= buff;
	}
	int pos = 0;
	while(pos >= 0 && pos < n){
		if(p[pos] == 0)break;
		else{
			buff = pos;
			pos += p[pos];
			p[buff] = 0;
		}
	}
	if(pos >= 0 && pos < n)cout << "INFINITE\n";
	else cout << "FINITE\n";
	return;
}

void solveC(){
	int n, m, q;
	cin >> n >> m >> q;
	int dp[n][m];
	int v;
	int x, y, z;
	const int r228 = 2000000000;
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < m; ++j)
			dp[i][j] = r228;

	for(int i = 0; i < q; ++i){
		cin >> v;
		if(v == 3){
			cin >> x >> y >> z;
			--x;
			--y;
			dp[x][y] = z;
		}
		if(v == 2){
			cin >> y;
			--y;
			z = dp[0][y];
			for(int i = 0; i < n - 1; ++i)
				dp[i][y] = dp[i+1][y];
			dp[n-1][y] = z;
		}
		if(v == 1){
			cin >> x;
			--x;
			z = dp[x][0];
			for(int i = 0; i < m - 1; ++i)
				dp[x][i] = dp[x][i+1];
			dp[x][m-1] = z;
		}
	}
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j)
			cout << (dp[i][j] == r228 ? 0 : dp[i][j]) << ' ';
		cout << endl;
	}

}

void solveCc(){
	int n, m, q;
	cin >> n >> m >> q;
	int dp[n][m];
	int v;
	int x, y, z;
	const int r228 = 2000000000;
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < m; ++j)
			dp[i][j] = r228;
	int a[q],b[q],c[q],d[q];
	for(int i = 0; i < q; ++i){
		cin >> a[i];
		if(a[i] == 3){
			cin >> b[i] >> c[i] >> d[i];
			--b[i];
			--c[i];
		}
		else{
			cin >> b[i];
			--b[i];
		}
	}
	for(int i = q - 1; i >= 0; --i){
		v = a[i];
		if(v == 3){
			x = b[i];
			y = c[i];
			z = d[i];
			dp[x][y] = z;
		}
		if(v == 2){
			y = b[i];
			z = dp[n-1][y];
			for(int i = n-1; i >0; --i)
				dp[i][y] = dp[i-1][y];
			dp[0][y] = z;
		}
		if(v == 1){
			x = b[i];
			z = dp[x][m-1];
			for(int i = m-1; i >0; --i)
				dp[x][i] = dp[x][i-1];
			dp[x][0] = z;
		}
	}
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j)
			cout << (dp[i][j] == r228 ? 0 : dp[i][j]) << ' ';
		cout << endl;
	}

}

struct Z{
	int ind;
	int time;
	int val;
	int adres;
};

bool operator<(Z lhs, Z rhs){
	return lhs.time < rhs.time;
}

void solveE(){
	int n;
	cin >> n;
	Z p[n];
	int ans[n];
	for(int i = 0; i < n; ++i){
		cin >> p[i].ind >> p[i].time >> p[i].val;
		ans[i] = -1;
		p[i].adres = i;
	}
	sort(p, p + n);
	multiset <int> s;
	for(int i = 0; i < n; ++i){
		if(p[i].ind == 1){
			s.insert(p[i].val);
		}
		if(p[i].ind == 2){
			s.erase(s.find(p[i].val));
		}
		if(p[i].ind == 3){
			ans[p[i].adres] = s.count(p[i].val);
		}
	}
	for(int i = 0; i < n; ++i)if(ans[i] != -1)cout << ans[i] << endl;
}

void solveD(){
	int n, q;
	cin >> n >> q;
	long long delt1 = 0, delt2 = 0;
	long long x, y, z = 0;
	for(int i = 0; i < q; ++i){
		cin >> x;
		if(x == 2){
			if(z){
				--delt1;
				++delt2;
				z = 0;
			}
			else{
				++delt1;
				--delt2;
				z = 1;
			}
		}
		else{
			cin >> y;
			delt1 += y;
			delt2 += y;
			if(y % 2) z = !z;
		}
		//cerr << delt1 << ' ' << delt2 << endl;
	}
	long long ans[n];
	for(long long i = 1; i <= n; ++i){
		ans[((i + ((i%2)?delt1:delt2))%n - 1+n)%n] = i;
	}
	for(long long i = 0; i < n; ++i)cout << ans[i] << ' ';
}

int main(){
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
	solveD();
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iterator>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>

#define myDEBUG

#ifdef myDEBUG

#define assert(x) \
	if(!x){\
		cerr<<"\n\nERROR!\tFailed: "<<x;\
		cerr<<"\nLine: "<<__LINE__;\
		cerr<<"\nFile: "<<__FILE__;\
		cerr<<"\nTime: "<<__TIME__;\
		cerr<<"\nDate: "<<__DATE__;\
	}

#define err(x) assert(x)
#define warn(x) assert(x)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

void solveA(){
	long long n;
	cin >> n;
	long long ans = (n / 3)*2;
	n = n % 3;
	cout << ans + (n != 0);

}

void solveB(){
	int n;
	cin >> n;
	int p[n];
	char work;
	int buff;
	for(int i = 0; i < n; ++i){
		cin >> work;
		if(work == '<')p[i] = -1;
		if(work == '>')p[i] = 1;
	}
	for(int i = 0; i < n; ++i){
		cin >> buff;
		p[i] *= buff;
	}
	int pos = 0;
	while(pos >= 0 && pos < n){
		if(p[pos] == 0)break;
		else{
			buff = pos;
			pos += p[pos];
			p[buff] = 0;
		}
	}
	if(pos >= 0 && pos < n)cout << "INFINITE\n";
	else cout << "FINITE\n";
	return;
}

void solveC(){
	int n, m, q;
	cin >> n >> m >> q;
	int dp[n][m];
	int v;
	int x, y, z;
	const int r228 = 2000000000;
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < m; ++j)
			dp[i][j] = r228;

	for(int i = 0; i < q; ++i){
		cin >> v;
		if(v == 3){
			cin >> x >> y >> z;
			--x;
			--y;
			dp[x][y] = z;
		}
		if(v == 2){
			cin >> y;
			--y;
			z = dp[0][y];
			for(int i = 0; i < n - 1; ++i)
				dp[i][y] = dp[i+1][y];
			dp[n-1][y] = z;
		}
		if(v == 1){
			cin >> x;
			--x;
			z = dp[x][0];
			for(int i = 0; i < m - 1; ++i)
				dp[x][i] = dp[x][i+1];
			dp[x][m-1] = z;
		}
	}
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j)
			cout << (dp[i][j] == r228 ? 0 : dp[i][j]) << ' ';
		cout << endl;
	}

}

void solveCc(){
	int n, m, q;
	cin >> n >> m >> q;
	int dp[n][m];
	int v;
	int x, y, z;
	const int r228 = 2000000000;
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < m; ++j)
			dp[i][j] = r228;
	int a[q],b[q],c[q],d[q];
	for(int i = 0; i < q; ++i){
		cin >> a[i];
		if(a[i] == 3){
			cin >> b[i] >> c[i] >> d[i];
			--b[i];
			--c[i];
		}
		else{
			cin >> b[i];
			--b[i];
		}
	}
	for(int i = q - 1; i >= 0; --i){
		v = a[i];
		if(v == 3){
			x = b[i];
			y = c[i];
			z = d[i];
			dp[x][y] = z;
		}
		if(v == 2){
			y = b[i];
			z = dp[n-1][y];
			for(int i = n-1; i >0; --i)
				dp[i][y] = dp[i-1][y];
			dp[0][y] = z;
		}
		if(v == 1){
			x = b[i];
			z = dp[x][m-1];
			for(int i = m-1; i >0; --i)
				dp[x][i] = dp[x][i-1];
			dp[x][0] = z;
		}
	}
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j)
			cout << (dp[i][j] == r228 ? 0 : dp[i][j]) << ' ';
		cout << endl;
	}

}

struct Z{
	int ind;
	int time;
	int val;
	int adres;
};

bool operator<(Z lhs, Z rhs){
	return lhs.time < rhs.time;
}

void solveE(){
	int n;
	cin >> n;
	Z p[n];
	int ans[n];
	for(int i = 0; i < n; ++i){
		cin >> p[i].ind >> p[i].time >> p[i].val;
		ans[i] = -1;
		p[i].adres = i;
	}
	sort(p, p + n);
	multiset <int> s;
	for(int i = 0; i < n; ++i){
		if(p[i].ind == 1){
			s.insert(p[i].val);
		}
		if(p[i].ind == 2){
			s.erase(s.find(p[i].val));
		}
		if(p[i].ind == 3){
			ans[p[i].adres] = s.count(p[i].val);
		}
	}
	for(int i = 0; i < n; ++i)if(ans[i] != -1)cout << ans[i] << endl;
}

void solveD(){
	int n, q;
	//cin >> n >> q;
	scanf("%d%d", &n, &q);
	long long delt1 = 0, delt2 = 0;
	int x, y, z = 0;
	for(int i = 0; i < q; ++i){
		//cin >> x;
		scanf("%d", &x);
		if(x == 2){
			if(z){
				--delt1;
				++delt2;
				z = 0;
			}
			else{
				++delt1;
				--delt2;
				z = 1;
			}
		}
		else{
			//cin >> y;
			scanf("%d", &y);
			delt1 += y;
			delt2 += y;
			if(y % 2) z = !z;
		}
	}
	int ans[n];
	for(long long i = 1; i <= n; ++i){
		ans[((i + ((i%2)?delt1:delt2))%n - 1+n)%n] = i;
	}
	for(long long i = 0; i < n; ++i)printf("%d ",((int)ans[i]));//cout << ans[i] << ' ';
	printf("\n");
}

int main(){
	solveD();
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iterator>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>

#define myDEBUG

#ifdef myDEBUG

#define assert(x) \
	if(!x){\
		cerr<<"\n\nERROR!\tFailed: "<<x;\
		cerr<<"\nLine: "<<__LINE__;\
		cerr<<"\nFile: "<<__FILE__;\
		cerr<<"\nTime: "<<__TIME__;\
		cerr<<"\nDate: "<<__DATE__;\
	}

#define err(x) assert(x)
#define warn(x) assert(x)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

void solveA(){
	long long n;
	cin >> n;
	long long ans = (n / 3)*2;
	n = n % 3;
	cout << ans + (n != 0);

}

void solveB(){
	int n;
	cin >> n;
	int p[n];
	char work;
	int buff;
	for(int i = 0; i < n; ++i){
		cin >> work;
		if(work == '<')p[i] = -1;
		if(work == '>')p[i] = 1;
	}
	for(int i = 0; i < n; ++i){
		cin >> buff;
		p[i] *= buff;
	}
	int pos = 0;
	while(pos >= 0 && pos < n){
		if(p[pos] == 0)break;
		else{
			buff = pos;
			pos += p[pos];
			p[buff] = 0;
		}
	}
	if(pos >= 0 && pos < n)cout << "INFINITE\n";
	else cout << "FINITE\n";
	return;
}

void solveC(){
	int n, m, q;
	cin >> n >> m >> q;
	int dp[n][m];
	int v;
	int x, y, z;
	const int r228 = 2000000000;
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < m; ++j)
			dp[i][j] = r228;

	for(int i = 0; i < q; ++i){
		cin >> v;
		if(v == 3){
			cin >> x >> y >> z;
			--x;
			--y;
			dp[x][y] = z;
		}
		if(v == 2){
			cin >> y;
			--y;
			z = dp[0][y];
			for(int i = 0; i < n - 1; ++i)
				dp[i][y] = dp[i+1][y];
			dp[n-1][y] = z;
		}
		if(v == 1){
			cin >> x;
			--x;
			z = dp[x][0];
			for(int i = 0; i < m - 1; ++i)
				dp[x][i] = dp[x][i+1];
			dp[x][m-1] = z;
		}
	}
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j)
			cout << (dp[i][j] == r228 ? 0 : dp[i][j]) << ' ';
		cout << endl;
	}

}

void solveCc(){
	int n, m, q;
	cin >> n >> m >> q;
	int dp[n][m];
	int v;
	int x, y, z;
	const int r228 = 2000000000;
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < m; ++j)
			dp[i][j] = r228;
	int a[q],b[q],c[q],d[q];
	for(int i = 0; i < q; ++i){
		cin >> a[i];
		if(a[i] == 3){
			cin >> b[i] >> c[i] >> d[i];
			--b[i];
			--c[i];
		}
		else{
			cin >> b[i];
			--b[i];
		}
	}
	for(int i = q - 1; i >= 0; --i){
		v = a[i];
		if(v == 3){
			x = b[i];
			y = c[i];
			z = d[i];
			dp[x][y] = z;
		}
		if(v == 2){
			y = b[i];
			z = dp[n-1][y];
			for(int i = n-1; i >0; --i)
				dp[i][y] = dp[i-1][y];
			dp[0][y] = z;
		}
		if(v == 1){
			x = b[i];
			z = dp[x][m-1];
			for(int i = m-1; i >0; --i)
				dp[x][i] = dp[x][i-1];
			dp[x][0] = z;
		}
	}
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j)
			cout << (dp[i][j] == r228 ? 0 : dp[i][j]) << ' ';
		cout << endl;
	}

}

struct Z{
	int ind;
	int time;
	int val;
	int adres;
};

bool operator<(Z lhs, Z rhs){
	return lhs.time < rhs.time;
}

void solveE(){
	int n;
	cin >> n;
	Z p[n];
	int ans[n];
	for(int i = 0; i < n; ++i){
		cin >> p[i].ind >> p[i].time >> p[i].val;
		ans[i] = -1;
		p[i].adres = i;
	}
	sort(p, p + n);
	multiset <int> s;
	for(int i = 0; i < n; ++i){
		if(p[i].ind == 1){
			s.insert(p[i].val);
		}
		if(p[i].ind == 2){
			s.erase(s.find(p[i].val));
		}
		if(p[i].ind == 3){
			ans[p[i].adres] = s.count(p[i].val);
		}
	}
	for(int i = 0; i < n; ++i)if(ans[i] != -1)cout << ans[i] << endl;
}

void solveD(){
	int n, q;
	//cin >> n >> q;
	scanf("%d%d", &n, &q);
	long long delt1 = 0, delt2 = 0;
	long long x, y, z = 0;
	for(int i = 0; i < q; ++i){
		//cin >> x;
		scanf("%d", &x);
		if(x == 2){
			if(z){
				--delt1;
				++delt2;
				z = 0;
			}
			else{
				++delt1;
				--delt2;
				z = 1;
			}
		}
		else{
			//cin >> y;
			scanf("%d", &y);
			delt1 += y;
			delt2 += y;
			if(y % 2) z = !z;
		}
	}
	long long ans[n];
	for(long long i = 1; i <= n; ++i){
		ans[((i + ((i%2)?delt1:delt2))%n - 1+n)%n] = i;
	}
	for(long long i = 0; i < n; ++i)printf("%d ",((int)ans[i]));//cout << ans[i] << ' ';
	printf("\n");
}

int main(){
	solveD();
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iterator>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>

#define myDEBUG

#ifdef myDEBUG

#define assert(x) \
	if(!x){\
		cerr<<"\n\nERROR!\tFailed: "<<x;\
		cerr<<"\nLine: "<<__LINE__;\
		cerr<<"\nFile: "<<__FILE__;\
		cerr<<"\nTime: "<<__TIME__;\
		cerr<<"\nDate: "<<__DATE__;\
	}

#define err(x) assert(x)
#define warn(x) assert(x)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

void solveA(){
	long long n;
	cin >> n;
	long long ans = (n / 3)*2;
	n = n % 3;
	cout << ans + (n != 0);

}

void solveB(){
	int n;
	cin >> n;
	int p[n];
	char work;
	int buff;
	for(int i = 0; i < n; ++i){
		cin >> work;
		if(work == '<')p[i] = -1;
		if(work == '>')p[i] = 1;
	}
	for(int i = 0; i < n; ++i){
		cin >> buff;
		p[i] *= buff;
	}
	int pos = 0;
	while(pos >= 0 && pos < n){
		if(p[pos] == 0)break;
		else{
			buff = pos;
			pos += p[pos];
			p[buff] = 0;
		}
	}
	if(pos >= 0 && pos < n)cout << "INFINITE\n";
	else cout << "FINITE\n";
	return;
}

void solveC(){
	int n, m, q;
	cin >> n >> m >> q;
	int dp[n][m];
	int v;
	int x, y, z;
	const int r228 = 2000000000;
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < m; ++j)
			dp[i][j] = r228;

	for(int i = 0; i < q; ++i){
		cin >> v;
		if(v == 3){
			cin >> x >> y >> z;
			--x;
			--y;
			dp[x][y] = z;
		}
		if(v == 2){
			cin >> y;
			--y;
			z = dp[0][y];
			for(int i = 0; i < n - 1; ++i)
				dp[i][y] = dp[i+1][y];
			dp[n-1][y] = z;
		}
		if(v == 1){
			cin >> x;
			--x;
			z = dp[x][0];
			for(int i = 0; i < m - 1; ++i)
				dp[x][i] = dp[x][i+1];
			dp[x][m-1] = z;
		}
	}
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j)
			cout << (dp[i][j] == r228 ? 0 : dp[i][j]) << ' ';
		cout << endl;
	}

}

void solveCc(){
	int n, m, q;
	cin >> n >> m >> q;
	int dp[n][m];
	int v;
	int x, y, z;
	const int r228 = 2000000000;
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < m; ++j)
			dp[i][j] = r228;
	int a[q],b[q],c[q],d[q];
	for(int i = 0; i < q; ++i){
		cin >> a[i];
		if(a[i] == 3){
			cin >> b[i] >> c[i] >> d[i];
			--b[i];
			--c[i];
		}
		else{
			cin >> b[i];
			--b[i];
		}
	}
	for(int i = q - 1; i >= 0; --i){
		v = a[i];
		if(v == 3){
			x = b[i];
			y = c[i];
			z = d[i];
			dp[x][y] = z;
		}
		if(v == 2){
			y = b[i];
			z = dp[n-1][y];
			for(int i = n-1; i >0; --i)
				dp[i][y] = dp[i-1][y];
			dp[0][y] = z;
		}
		if(v == 1){
			x = b[i];
			z = dp[x][m-1];
			for(int i = m-1; i >0; --i)
				dp[x][i] = dp[x][i-1];
			dp[x][0] = z;
		}
	}
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j)
			cout << (dp[i][j] == r228 ? 0 : dp[i][j]) << ' ';
		cout << endl;
	}

}

struct Z{
	int ind;
	int time;
	int val;
	int adres;
};

bool operator<(Z lhs, Z rhs){
	return lhs.time < rhs.time;
}

void solveE(){
	int n;
	cin >> n;
	Z p[n];
	int ans[n];
	for(int i = 0; i < n; ++i){
		cin >> p[i].ind >> p[i].time >> p[i].val;
		ans[i] = -1;
		p[i].adres = i;
	}
	sort(p, p + n);
	multiset <int> s;
	for(int i = 0; i < n; ++i){
		if(p[i].ind == 1){
			s.insert(p[i].val);
		}
		if(p[i].ind == 2){
			s.erase(s.find(p[i].val));
		}
		if(p[i].ind == 3){
			ans[p[i].adres] = s.count(p[i].val);
		}
	}
	for(int i = 0; i < n; ++i)if(ans[i] != -1)cout << ans[i] << endl;
}

void solveD(){
	int n, q;
	//cin >> n >> q;
	scanf("%d%d", &n, &q);
	long long delt1 = 0, delt2 = 0;
	long long x, y, z = 0;
	for(int i = 0; i < q; ++i){
		//cin >> x;
		scanf("%d", &x);
		if(x == 2){
			if(z){
				--delt1;
				++delt2;
				z = 0;
			}
			else{
				++delt1;
				--delt2;
				z = 1;
			}
		}
		else{
			//cin >> y;
			scanf("%d", &y);
			delt1 += y;
			delt2 += y;
			if(y % 2) z = !z;
		}
	}
	long long ans[n];
	for(long long i = 1; i <= n; ++i){
		ans[((i + ((i%2)?delt1:delt2))%n - 1+n)%n] = i;
	}
	for(long long i = 0; i < n; ++i)printf("%d ",ans[i]);//cout << ans[i] << ' ';
}

int main(){
	solveD();
	return 0;
}


#include<bits/stdc++.h>
#define f(i,l,r) for(i=l;i<r;i++)
#define s(n) scanf("%lld",&n)
#define pl(n) printf("%lld\n",n)
#define p(n) printf("%lld",n)
#define ll long long int
#define mod 1000000007
#define maxa 1000005
#define maxv 1000000009
#define pi 3.14159265358979323846
#define all(v) v.begin() , v.end()
using namespace std;
int main(){
    ll q,n,i,state,x,d,odd,even,a[1000005];
    s(n);
    s(q);
    odd = 0;
    even =  0;
    state = 0;
    while(q--){
        s(x);
        if(x == 1){
            s(d);
            odd+=d;
            even+=d;
        }
        else{
            if(state == 0){
                state = 1;
                odd++;
                even--;
            }
            else{
                state = 0;
                odd--;
                even++;
            }
        }
    }
    for(i=1;i<=n;i++){
        if(i%2 == 0){
            ll temp = (i+even)%n;
            if(temp == 0)
                temp = n;
            a[temp] = i;
        }
        else{
            ll temp = (i+odd)%n;
            if(temp == 0)
                temp = n;
            a[temp] =i;
        }
    }
    for(i=1;i<=n;i++)
        printf("%lld ",a[i]);
    printf("\n");
    return 0;
}


#include<bits/stdc++.h>
#define f(i,l,r) for(i=l;i<r;i++)
#define s(n) scanf("%lld",&n)
#define pl(n) printf("%lld\n",n)
#define p(n) printf("%lld",n)
#define ll long long int
#define mod 1000000007
#define maxa 1000005
#define maxv 1000000009
#define pi 3.14159265358979323846
#define all(v) v.begin() , v.end()
using namespace std;
int main(){
    ll q,n,i,state,x,d,odd,even,a[1000005];
    s(n);
    s(q);
    odd = 0;
    even =  0;
    state = 0;
    while(q--){
        s(x);
        if(x == 1){
            s(d);
            odd+=d;
            even+=d;
        }
        else{
            if(state == 0){
                state = 1;
                odd++;
                even--;
            }
            else{
                state = 0;
                odd--;
                even++;
            }
        }
    }
    for(i=1;i<=n;i++){
        if(i%2 == 0){
            ll temp = (i+even);
            while(temp < 0)
                temp+=n;
            temp%=n;
            if(temp == 0)
                temp = n;
            a[temp] = i;
        }
        else{
            ll temp = (i+odd);
            while(temp < 0)
                temp+=n;
            temp%=n;
            if(temp == 0)
                temp = n;
            a[temp] =i;
        }
    }
    for(i=1;i<=n;i++)
        printf("%lld ",a[i]);
    printf("\n");
    return 0;
}


#include<bits/stdc++.h>
#define f(i,l,r) for(i=l;i<r;i++)
#define s(n) scanf("%lld",&n)
#define pl(n) printf("%lld\n",n)
#define p(n) printf("%lld",n)
#define ll long long int
#define mod 1000000007
#define maxa 1000005
#define maxv 1000000009
#define pi 3.14159265358979323846
#define all(v) v.begin() , v.end()
using namespace std;
int main(){
    ll q,n,i,state,x,d,odd,even,a[1000005];
    s(n);
    s(q);
    odd = 0;
    even =  0;
    state = 0;
    while(q--){
        s(x);
        if(x == 1){
            s(d);
            if(d < 0){
                ll temp = (-d)/n;
                if((-d)%n!=0)
                    temp++;
                d += temp*n;
            }
            odd+=d;
            even+=d;
        }
        else{
            if(odd%2 == 0)
            {
                odd++;
                d=-1;
                if(d < 0){
                    ll temp = (-d)/n;
                    if((-d)%n!=0)
                        temp++;
                    d += temp*n;
                }
                even+=d;
            }
            else{
                even++;
                d = -1;
                if(d < 0){
                    ll temp = (-d)/n;
                    if((-d)%n!=0)
                        temp++;
                    d += temp*n;
                }
                odd+=d;
            }
        }
    }
    for(i=1;i<=n;i++){
        if(i%2 == 0){
            ll temp = (i+even);
            temp%=n;
            if(temp == 0)
                temp = n;
            a[temp] = i;
        }
        else{
            ll temp = (i+odd);
            temp%=n;
            if(temp == 0)
                temp = n;
            a[temp] = i;
        }
    }
    for(i=1;i<=n;i++)
        printf("%lld ",a[i]);
    printf("\n");
    /*//else{
    for(i=1;i<n;i+=2){
        printf("%lld %lld ",a[i+1],a[i]);
    }
    printf("\n");
    //}*/
    return 0;
}


#include<bits/stdc++.h>
#define f(i,l,r) for(i=l;i<r;i++)
#define s(n) scanf("%lld",&n)
#define pl(n) printf("%lld\n",n)
#define p(n) printf("%lld",n)
#define ll long long int
#define mod 1000000007
#define maxa 1000005
#define maxv 1000000009
#define pi 3.14159265358979323846
#define all(v) v.begin() , v.end()
using namespace std;
int main(){
    ll q,n,i,state,x,d,odd,even,a[1000005];
    s(n);
    s(q);
    odd = 0;
    even =  0;
    state = 0;
    while(q--){
        s(x);
        if(x == 1){
            s(d);
            if(d < 0){
                ll temp = (-d)/n;
                if((-d)%n!=0)
                    temp++;
                d += temp*n;
            }
            if(d == n-1){
                if(state)
                    state = 0;
                else
                    state = 1;
            }
            odd+=d;
            even+=d;
        }
        else{
            d = -1;
            if(state == 0){
                state = 1;
                odd++;
                if(d < 0){
                    ll temp = (-d)/n;
                    if((-d)%n!=0)
                        temp++;
                    d += temp*n;
                }
                even+=d;
            }
            else{
                state = 0;
                even++;
                if(d < 0){
                    ll temp = (-d)/n;
                    if((-d)%n!=0)
                        temp++;
                    d += temp*n;
                }
                odd+=d;
            }
        }
    }
    for(i=1;i<=n;i++){
        if(i%2 == 0){
            ll temp = (i+even);
            temp%=n;
            if(temp == 0)
                temp = n;
            a[temp] = i;
        }
        else{
            ll temp = (i+odd);
            temp%=n;
            if(temp == 0)
                temp = n;
            a[temp] = i;
        }
    }
    for(i=1;i<=n;i++)
        printf("%lld ",a[i]);
    printf("\n");
    return 0;
}


#include<bits/stdc++.h>
#define f(i,l,r) for(i=l;i<r;i++)
#define s(n) scanf("%lld",&n)
#define pl(n) printf("%lld\n",n)
#define p(n) printf("%lld",n)
#define ll long long int
#define mod 1000000007
#define maxa 1000005
#define maxv 1000000009
#define pi 3.14159265358979323846
#define all(v) v.begin() , v.end()
using namespace std;
int main(){
    ll q,n,i,state,x,d,odd,even,a[1000005];
    s(n);
    s(q);
    odd = 0;
    even =  0;
    state = 0;
    while(q--){
        s(x);
        if(x == 1){
            s(d);
            if(d < 0){
                ll temp = (-d)/n;
                if((-d)%n!=0)
                    temp++;
                d += temp*n;
            }
            odd+=d;
            even+=d;
        }
        else{
            if(state == 0){
                state = 1;
                odd++;
                even--;
            }
            else{
                state = 0;
                odd--;
                even++;
            }
        }
    }
    for(i=1;i<=n;i++){
        if(i%2 == 0){
            ll temp = (i+even);
            temp%=n;
            if(temp == 0)
                temp = n;
            a[temp] = i;
        }
        else{
            ll temp = (i+odd);
            temp%=n;
            if(temp == 0)
                temp = n;
            a[temp] = i;
        }
    }
    for(i=1;i<=n;i++)
        printf("%lld ",a[i]);
    printf("\n");
    return 0;
}


#include <iostream>
#include <stdio.h>

using namespace std;

int n, q, paren, neparen, one, two, i;
    int krajniza[1000001];

int main(){

    paren = 2;
    neparen = 1;
    scanf("%d%d", &n, &q);

    for (i=0; i<q; i++){
        scanf("%d", &one);
        if (one==1){
            scanf("%d", &two);
            paren = paren + two;
            neparen = neparen + two;
            if (neparen > n){
                neparen = neparen % n;
            }
            else if (neparen <1){
                neparen = n + neparen;
            }
            if (paren > n){
                paren = paren % n;
            }
            else if (paren < 1){
                paren = n + paren;
            }
            if (paren==0)
                paren = n;
            if (neparen==0)
                neparen = n;
        }
        else if (one==2){
            if (paren%2==0){
                paren--;
            }
            else
                paren++;
            if (neparen%2==0){
                neparen--;
            }
            else
                neparen++;
        }
    }
    int brojparen = 2;
    int brojneparen = 1;
    for (i=0; i<n/2; i++){
        krajniza[neparen-1] = brojneparen;
        brojneparen = brojneparen + 2;
        neparen = neparen + 2;
        if (neparen > n){
            neparen = neparen % n;
        }
        krajniza[paren-1] = brojparen;
        brojparen = brojparen + 2;
        paren = paren + 2;
        if (paren > n){
            paren = paren % n;
        }
    }
    for (i=0; i<n; i++){
        cout<<krajniza[i]<<" ";
    }
    return 0;
}


#include <iostream>
#include <stdio.h>

using namespace std;

int n, q, paren, neparen, one, two, i;
    int krajniza[1000001];

int main(){

    paren = 2;
    neparen = 1;
    scanf("%d%d", &n, &q);

    for (i=0; i<q; i++){
        scanf("%d", &one);
        if (one==1){
            scanf("%d", &two);
            paren = paren + two;
            neparen = neparen + two;
            if (neparen > n){
                neparen = neparen % n;
            }
            else if (neparen <1){
                neparen = n + neparen;
            }
            if (paren > n){
                paren = paren % n;
            }
            else if (paren < 1){
                paren = n + paren;
            }
        }
        else if (one==2){
            if (paren%2==0){
                paren--;
            }
            else
                paren++;
            if (neparen%2==0){
                neparen--;
            }
            else
                neparen++;
        }
    }
    int brojparen = 2;
    int brojneparen = 1;
    for (i=0; i<n/2; i++){
        krajniza[neparen-1] = brojneparen;
        brojneparen = brojneparen + 2;
        neparen = neparen + 2;
        if (neparen > n){
            neparen = neparen % n;
        }
        krajniza[paren-1] = brojparen;
        brojparen = brojparen + 2;
        paren = paren + 2;
        if (paren > n){
            paren = paren % n;
        }
    }
    for (i=0; i<n; i++){
        cout<<krajniza[i]<<" ";
    }
    return 0;
}


#include <iostream>
#include <stdio.h>

using namespace std;

int n, q, paren, neparen, one, two, i;
    int krajniza[1000001];

int main(){

    paren = 2;
    neparen = 1;
    scanf("%d%d", &n, &q);

    for (i=0; i<q; i++){
        scanf("%d", &one);
        if (one==1){
            scanf("%d", &two);
            paren = paren + two;
            neparen = neparen + two;
            if (neparen > n){
                neparen = neparen % n;
            }
            else if (neparen <1){
                neparen = n + neparen;
            }
            if (paren > n){
                paren = paren % n;
            }
            else if (paren < 1){
                paren = n + paren;
            }
        }
        else if (one==2){
            if (paren%2==0){
                paren--;
            }
            else
                paren++;
            if (neparen%2==0){
                neparen--;
            }
            else
                neparen++;
        }
    }
    neparen;
    paren;
    int brojparen = 2;
    int brojneparen = 1;
    for (i=0; i<n/2; i++){
        krajniza[neparen-1] = brojneparen;
        brojneparen = brojneparen + 2;
        neparen = neparen + 2;
        if (neparen > n){
            neparen = neparen % n;
        }
        krajniza[paren-1] = brojparen;
        brojparen = brojparen + 2;
        paren = paren + 2;
        if (paren > n){
            paren = paren % n;
        }
    }
    for (i=0; i<n; i++){
        cout<<krajniza[i]<<" ";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <assert.h>

using namespace std;

const int MAX_N = 1e3 + 5;

int targ [MAX_N];
char grid [MAX_N][MAX_N];

int cur;
void shift_right (vector<int> idxs) {
  grid[cur][0] = '\\';
  grid[cur][idxs[0]] = '\\';
  cur++;

  grid[cur][0] = '/';
  for (int i : idxs) {
    grid[cur][i] = '/';
  }
  cur++;

  int tmp = targ[idxs.back()];
  for (int i = (int) idxs.size() - 1; i > 0; i--) {
    targ[idxs[i]] = targ[idxs[i - 1]];
  }
  targ[idxs[0]] = tmp;
}

bool right_ok (vector<int> idxs) {
  int cnt = 0;
  for (int i = (int) idxs.size() - 1; i > 0; i--) {
    if (idxs[i] == targ[idxs[i - 1]]) cnt++;
  }
  if (idxs[0] == targ[idxs.back()]) cnt++;

  return cnt > 1;
}

void shift_left (vector<int> idxs) {
  grid[cur][0] = '\\';
  for (int i : idxs) {
    grid[cur][i] = '\\';
  }
  cur++;

  grid[cur][0] = '/';
  grid[cur][idxs.back()] = '/';
  cur++;

  int tmp = targ[idxs[0]];
  for (int i = 0; i < (int) idxs.size() - 1; i++) {
    targ[idxs[i]] = targ[idxs[i + 1]];
  }
  targ[idxs.back()] = tmp;
}

bool left_ok (vector<int> idxs) {
  int cnt = 0;
  for (int i = 0; i < (int) idxs.size() - 1; i++) {
    if (idxs[i] == targ[idxs[i + 1]]) cnt++;
  }
  if (idxs.back() == targ[idxs[0]]) cnt++;

  return cnt > 1;
}

void shift_tar0 (int tar0, int pre) {
  if (pre < tar0) {
    grid[cur][0] = '\\';
    grid[cur][tar0] = '\\';
    cur++;

    grid[cur][pre] = '/';
    grid[cur][tar0] = '/';
    cur++;
  } else {
    grid[cur][0] = '\\';
    grid[cur][pre] = '\\';
    grid[cur][tar0] = '\\';
    cur++;
  }
}

void shift_tar0 (int tar0) {
  grid[cur][0] = '\\';
  grid[cur][tar0] = '\\';
}

int main () {
  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      grid[i][j] = '.';
    }
  }

  bool perf = true;
  for (int i = 0; i < n; i++) {
    cin >> targ[i];
    targ[i]--;
    if (targ[i] != i) {
      perf = false;
    }
  }

  if (perf) {
    cout << n << endl;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cout << '.';
      }
      cout << '\n';
    }
    return 0;
  }

  while (true) {
    int st = -1;
    for (int i = 1; i < n; i++) {
      if (targ[i] != i && targ[i] != 0 && targ[targ[i]] != 0) {
        st = i;
      }
    }

    if (st != -1) {
      if (targ[targ[st]] == st) {
        vector<int> sub = {st, targ[st]};
        shift_right(sub);
      } else {
        vector<int> sub = {st, targ[st], targ[targ[st]]};
        sort(sub.begin(), sub.end());

        if (right_ok(sub)) {
          shift_right(sub);
        } else if (left_ok(sub)) {
          shift_left(sub);
        } else {
          assert(false);
        }
      }
      continue;
    }

    for (int i = 1; i < n; i++) {
      if (targ[i] != i && targ[i] != 0) {
        st = i;
      }
    }

    if (st != -1) {
      shift_tar0(targ[st], st);
      break;
    }

    for (int i = 1; i < n; i++) {
      if (targ[i] != i) {
        st = i;
      }
    }

    if (st != -1) {
      shift_tar0(st);
      break;
    } else {
      // we are done!
      break;
    }
  }

  cout << n - 1 << endl;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < n; j++) {
      cout << grid[i][j];
    }
    cout << '\n';
  }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <assert.h>

using namespace std;

const int MAX_N = 1e3 + 5;

int targ [MAX_N];
char grid [MAX_N][MAX_N];

int cur;
void shift_right (vector<int> idxs) {
  grid[cur][0] = '\\';
  grid[cur][idxs[0]] = '\\';
  cur++;

  grid[cur][0] = '/';
  for (int i : idxs) {
    grid[cur][i] = '/';
  }
  cur++;

  int tmp = targ[idxs.back()];
  for (int i = (int) idxs.size() - 1; i > 0; i--) {
    targ[idxs[i]] = targ[idxs[i - 1]];
  }
  targ[idxs[0]] = tmp;
}

bool right_ok (vector<int> idxs) {
  int cnt = 0;
  for (int i = (int) idxs.size() - 1; i > 0; i--) {
    if (idxs[i] == targ[idxs[i - 1]]) cnt++;
  }
  if (idxs[0] == targ[idxs.back()]) cnt++;

  return cnt > 1;
}

void shift_left (vector<int> idxs) {
  grid[cur][0] = '\\';
  for (int i : idxs) {
    grid[cur][i] = '\\';
  }
  cur++;

  grid[cur][0] = '/';
  grid[cur][idxs.back()] = '/';
  cur++;

  int tmp = targ[idxs[0]];
  for (int i = 0; i < (int) idxs.size() - 1; i++) {
    targ[idxs[i]] = targ[idxs[i + 1]];
  }
  targ[idxs.back()] = tmp;
}

bool left_ok (vector<int> idxs) {
  int cnt = 0;
  for (int i = 0; i < (int) idxs.size() - 1; i++) {
    if (idxs[i] == targ[idxs[i + 1]]) cnt++;
  }
  if (idxs.back() == targ[idxs[0]]) cnt++;

  return cnt > 1;
}

void shift_tar0 (int tar0, int pre) {
  if (pre < tar0) {
    grid[cur][0] = '\\';
    grid[cur][tar0] = '\\';
    cur++;

    grid[cur][pre] = '/';
    grid[cur][tar0] = '/';
    cur++;
  } else {
    grid[cur][0] = '\\';
    grid[cur][pre] = '\\';
    grid[cur][tar0] = '\\';
    cur++;
  }
}

void shift_tar0 (int tar0) {
  grid[cur][0] = '\\';
  grid[cur][tar0] = '\\';
}

int main () {
  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      grid[i][j] = '.';
    }
  }

  bool perf = true;
  for (int i = 0; i < n; i++) {
    cin >> targ[i];
    targ[i]--;
    if (targ[i] != i) {
      perf = false;
    }
  }

  if (perf) {
    cout << n << endl;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cout << '.';
      }
      cout << '\n';
    }
    return 0;
  }

  while (true) {
    int st = -1;
    for (int i = 1; i < n; i++) {
      if (targ[i] != i && targ[i] != 0 && targ[targ[i]] != 0) {
        st = i;
      }
    }

    if (st != -1) {
      if (targ[targ[st]] == st) {
        shift_right({st, targ[st]});
      } else {
        vector<int> sub = {st, targ[st], targ[targ[st]]};
        sort(sub.begin(), sub.end());

        if (right_ok(sub)) {
          shift_right(sub);
        } else if (left_ok(sub)) {
          shift_left(sub);
        } else {
          assert(false);
        }
      }
      continue;
    }

    for (int i = 1; i < n; i++) {
      if (targ[i] != i && targ[i] != 0) {
        st = i;
      }
    }

    if (st != -1) {
      shift_tar0(targ[st], st);
      break;
    }

    for (int i = 1; i < n; i++) {
      if (targ[i] != i) {
        st = i;
      }
    }

    if (st != -1) {
      shift_tar0(st);
      break;
    } else {
      // we are done!
      break;
    }
  }

  cout << n - 1 << endl;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < n; j++) {
      cout << grid[i][j];
    }
    cout << '\n';
  }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <assert.h>

using namespace std;

const int MAX_N = 1e3 + 5;

int targ [MAX_N];
char grid [MAX_N][MAX_N];

int cur;
void shift_right (vector<int> idxs) {
  grid[cur][0] = '\\';
  grid[cur][idxs.back()] = '\\';
  cur++;

  grid[cur][0] = '/';
  for (int i : idxs) {
    grid[cur][i] = '/';
  }
  cur++;

  int tmp = targ[idxs.back()];
  for (int i = (int) idxs.size() - 1; i > 0; i--) {
    targ[idxs[i]] = targ[idxs[i - 1]];
  }
  targ[idxs[0]] = tmp;
}

bool right_ok (vector<int> idxs) {
  int cnt = 0;
  for (int i = (int) idxs.size() - 1; i > 0; i--) {
    if (idxs[i] == targ[idxs[i - 1]]) cnt++;
  }
  if (idxs[0] == targ[idxs.back()]) cnt++;

  return cnt > 1;
}

void shift_left (vector<int> idxs) {
  grid[cur][0] = '\\';
  for (int i : idxs) {
    grid[cur][i] = '\\';
  }
  cur++;

  grid[cur][0] = '/';
  grid[cur][idxs.back()] = '/';
  cur++;

  int tmp = targ[idxs[0]];
  for (int i = 0; i < (int) idxs.size() - 1; i++) {
    targ[idxs[i]] = targ[idxs[i + 1]];
  }
  targ[idxs.back()] = tmp;
}

bool left_ok (vector<int> idxs) {
  int cnt = 0;
  for (int i = 0; i < (int) idxs.size() - 1; i++) {
    if (idxs[i] == targ[idxs[i + 1]]) cnt++;
  }
  if (idxs.back() == targ[idxs[0]]) cnt++;

  return cnt > 1;
}

void shift_tar0 (int tar0, int pre) {
  if (pre < tar0) {
    grid[cur][0] = '\\';
    grid[cur][tar0] = '\\';
    cur++;

    grid[cur][pre] = '/';
    grid[cur][tar0] = '/';
    cur++;
  } else {
    grid[cur][0] = '\\';
    grid[cur][pre] = '\\';
    grid[cur][tar0] = '\\';
    cur++;
  }
}

void shift_tar0 (int tar0) {
  grid[cur][0] = '\\';
  grid[cur][tar0] = '\\';
}

int main () {
  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      grid[i][j] = '.';
    }
  }

  bool perf = true;
  for (int i = 0; i < n; i++) {
    cin >> targ[i];
    targ[i]--;
    if (targ[i] != i) {
      perf = false;
    }
  }

  if (perf) {
    cout << n << endl;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cout << '.';
      }
      cout << '\n';
    }
    return 0;
  }

  while (true) {
    int st = -1;
    for (int i = 1; i < n; i++) {
      if (targ[i] != i && targ[i] != 0 && targ[targ[i]] != 0) {
        st = i;
      }
    }

    if (st != -1) {
      if (targ[targ[st]] == st) {
        shift_right({st, targ[st]});
      } else {
        vector<int> sub = {st, targ[st], targ[targ[st]]};
        sort(sub.begin(), sub.end());

        if (right_ok(sub)) {
          shift_right(sub);
        } else if (left_ok(sub)) {
          shift_left(sub);
        } else {
          assert(false);
        }
      }
      continue;
    }

    for (int i = 1; i < n; i++) {
      if (targ[i] != i && targ[i] != 0) {
        st = i;
      }
    }

    if (st != -1) {
      shift_tar0(targ[st], st);
      break;
    }

    for (int i = 1; i < n; i++) {
      if (targ[i] != i) {
        st = i;
      }
    }

    if (st != -1) {
      shift_tar0(targ[st]);
      break;
    } else {
      // we are done!
      break;
    }
  }

  cout << n - 1 << endl;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < n; j++) {
      cout << grid[i][j];
    }
    cout << '\n';
  }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <assert.h>

using namespace std;

const int MAX_N = 1e3 + 5;

int targ [MAX_N];
char grid [MAX_N][MAX_N];

int cur;
void shift_right (vector<int> idxs) {
  grid[cur][0] = '\\';
  grid[cur][idxs.back()] = '\\';
  cur++;

  grid[cur][0] = '/';
  for (int i : idxs) {
    grid[cur][i] = '/';
  }
  cur++;

  int tmp = targ[idxs.back()];
  for (int i = (int) idxs.size() - 1; i > 0; i--) {
    targ[idxs[i]] = targ[idxs[i - 1]];
  }
  targ[idxs[0]] = tmp;
}

bool right_ok (vector<int> idxs) {
  int cnt = 0;
  for (int i = (int) idxs.size() - 1; i > 0; i--) {
    if (idxs[i] == targ[idxs[i - 1]]) cnt++;
  }
  if (idxs[0] == targ[idxs.back()]) cnt++;

  return cnt > 1;
}

void shift_left (vector<int> idxs) {
  grid[cur][0] = '\\';
  for (int i : idxs) {
    grid[cur][i] = '\\';
  }
  cur++;

  grid[cur][0] = '/';
  grid[cur][idxs.back()] = '/';
  cur++;

  int tmp = targ[idxs[0]];
  for (int i = 0; i < (int) idxs.size() - 1; i++) {
    targ[idxs[i]] = targ[idxs[i + 1]];
  }
  targ[idxs.back()] = tmp;
}

bool left_ok (vector<int> idxs) {
  int cnt = 0;
  for (int i = 0; i < (int) idxs.size() - 1; i++) {
    if (idxs[i] == targ[idxs[i + 1]]) cnt++;
  }
  if (idxs.back() == targ[idxs[0]]) cnt++;

  return cnt > 1;
}

void shift_tar0 (int tar0, int pre) {
  if (pre < tar0) {
    grid[cur][0] = '\\';
    grid[cur][tar0] = '\\';
    cur++;

    grid[cur][pre] = '/';
    grid[cur][tar0] = '/';
    cur++;
  } else {
    grid[cur][0] = '\\';
    grid[cur][pre] = '\\';
    grid[cur][tar0] = '\\';
    cur++;
  }
}

void shift_tar0 (int tar0) {
  grid[cur][0] = '\\';
  grid[cur][tar0] = '\\';
}

int main () {
  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      grid[i][j] = '.';
    }
  }

  bool perf = true;
  for (int i = 0; i < n; i++) {
    cin >> targ[i];
    targ[i]--;
    if (targ[i] != i) {
      perf = false;
    }
  }

  if (perf) {
    cout << n << endl;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        cout << '.';
      }
      cout << '\n';
    }
    return 0;
  }

  while (true) {
    int st = -1;
    for (int i = 1; i < n; i++) {
      if (targ[i] != i && targ[i] != 0 && targ[targ[i]] != 0) {
        st = i;
      }
    }

    if (st != -1) {
      if (targ[targ[st]] == st) {
        vector<int> sub = {st, targ[st]};
        sort(sub.begin(), sub.end());
        shift_right(sub);
      } else {
        vector<int> sub = {st, targ[st], targ[targ[st]]};
        sort(sub.begin(), sub.end());

        if (right_ok(sub)) {
          shift_right(sub);
        } else if (left_ok(sub)) {
          shift_left(sub);
        } else {
          assert(false);
        }
      }
      continue;
    }

    for (int i = 1; i < n; i++) {
      if (targ[i] != i && targ[i] != 0) {
        st = i;
      }
    }

    if (st != -1) {
      shift_tar0(targ[st], st);
      break;
    }

    for (int i = 1; i < n; i++) {
      if (targ[i] != i) {
        st = i;
      }
    }

    if (st != -1) {
      shift_tar0(st);
      break;
    } else {
      // we are done!
      break;
    }
  }

  cout << n - 1 << endl;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < n; j++) {
      cout << grid[i][j];
    }
    cout << '\n';
  }
}


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

int n;
int perm[1001];
bool seen[1001];
string grid[1001];

vector<vector<int>> cycles;

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n;
	for (int i = 0; i < n; i++) {
		cin>>perm[i];
		perm[i]--;
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			grid[i] += '.';
		}
	}

	for (int i = 0; i < n; i++) {
		if (seen[i]) continue;
		vector<int> cycle;
		int x = i;
		while (!seen[x]) {
			cycle.push_back(x);
			seen[x] = true;
			x = perm[x];
		}
		cycles.push_back(cycle);
		<<cycle.size()<<endl;
	}
	cerr<<cycles.size()<<endl;

	memset(seen, 0, sizeof seen);
	int y = n-1;
	int forsaken = -1;
	bool isfirst = true;
	int ans = 0;
	for (int i = 0; i < cycles.size(); i++) {
		if (cycles[i].size() == 1) {
			ans++;
			continue;
		}
		if (forsaken == -1) forsaken = cycles[i][0];

		y -= cycles[i].size();
		if (isfirst) y++;
		int leftmost = cycles[i][0];
		// Do it for this cycle, start from rightmost
		int x = leftmost;
		int lastx = -1;
		while (true) {
			int nxt = perm[x];
			assert(nxt != x);
			if (nxt == leftmost) break;
			if (nxt < x) {
				grid[y][x] = '\\';
				grid[y][nxt] = '\\';
			} else {
				grid[y][x] = '/';
				grid[y][nxt] = '/';
			}
			y++;
			x = nxt;
			lastx = x;
			ans++;
		}
		// If we're not last cycle, fill up my own starter
		if (!isfirst) {
			grid[y][lastx] = '\\'; // forsaken is always left
			grid[y][forsaken] = '\\';
			grid[y-cycles[i].size()+1][forsaken] = '/';
			ans++;
		}
		y -= cycles[i].size()-1;
		isfirst = false;
	}

	cout<<ans<<endl;
	for (int i = 0; i < n; i++) {
		cout<<grid[i]<<endl;
	}
}


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

int n;
int perm[1001];
bool seen[1001];
string grid[1001];

vector<vector<int>> cycles;

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n;
	for (int i = 0; i < n; i++) {
		cin>>perm[i];
		perm[i]--;
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			grid[i] += '.';
		}
	}

	for (int i = 0; i < n; i++) {
		if (seen[i]) continue;
		vector<int> cycle;
		int x = i;
		while (!seen[x]) {
			cycle.push_back(x);
			seen[x] = true;
			x = perm[x];
		}
		cycles.push_back(cycle);
		cerr<<cycle.size()<<endl;
	}
	cerr<<cycles.size()<<endl;

	memset(seen, 0, sizeof seen);
	int y = n-1;
	int forsaken = -1;
	bool isfirst = true;
	for (int i = 0; i < cycles.size(); i++) {
		if (cycles[i].size() == 1) continue;
		if (forsaken == -1) forsaken = cycles[i][0];

		y -= cycles[i].size();
		if (isfirst) y++;
		int leftmost = cycles[i][0];
		// Do it for this cycle, start from rightmost
		int x = leftmost;
		int lastx = -1;
		while (true) {
			int nxt = perm[x];
			assert(nxt != x);
			cerr<<y<<" "<<x<<endl;
			if (nxt == leftmost) break;
			if (nxt < x) {
				grid[y][x] = '\\';
				grid[y][nxt] = '\\';
			} else {
				grid[y][x] = '/';
				grid[y][nxt] = '/';
			}
			y++;
			x = nxt;
			lastx = x;
		}
		// If we're not last cycle, fill up my own starter
		if (!isfirst) {
			grid[y][lastx] = '\\'; // forsaken is always left
			grid[y][forsaken] = '\\';
			grid[y-cycles[i].size()+1][forsaken] = '/';
		}
		y -= cycles[i].size()-1;
		isfirst = false;
	}

	for (int i = 0; i < n; i++) {
		cout<<grid[i]<<endl;
	}
}


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

int n;
int perm[1001];
bool seen[1001];
string grid[1001];

vector<vector<int>> cycles;

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n;
	for (int i = 0; i < n; i++) {
		cin>>perm[i];
		perm[i]--;
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			grid[i] += '.';
		}
	}

	for (int i = 0; i < n; i++) {
		if (seen[i]) continue;
		vector<int> cycle;
		int x = i;
		while (!seen[x]) {
			cycle.push_back(x);
			seen[x] = true;
			x = perm[x];
		}
		cycles.push_back(cycle);
	}

	memset(seen, 0, sizeof seen);
	int y = n-1;
	int forsaken = -1;
	bool isfirst = true;
	int ans = 0;
	for (int i = 0; i < cycles.size(); i++) {
		if (cycles[i].size() == 1) {
			ans++;
			continue;
		}
		if (forsaken == -1) forsaken = cycles[i][0];

		y -= cycles[i].size();
		if (isfirst) y++;
		int leftmost = cycles[i][0];
		// Do it for this cycle, start from rightmost
		int x = leftmost;
		int lastx = -1;
		while (true) {
			int nxt = perm[x];
			assert(nxt != x);
			if (nxt == leftmost) break;
			if (nxt < x) {
				grid[y][x] = '\\';
				grid[y][nxt] = '\\';
			} else {
				grid[y][x] = '/';
				grid[y][nxt] = '/';
			}
			y++;
			x = nxt;
			lastx = x;
			ans++;
		}
		// If we're not last cycle, fill up my own starter
		if (!isfirst) {
			grid[y][lastx] = '\\'; // forsaken is always left
			grid[y][forsaken] = '\\';
			grid[y-cycles[i].size()+1][forsaken] = '/';
			ans++;
		}
		y -= cycles[i].size()-1;
		isfirst = false;
	}

	cout<<ans<<endl;
	for (int i = 0; i < n; i++) {
		cout<<grid[i]<<endl;
	}
}


// i wrote a frosty the snowman code and - something happened
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cstring>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<(int)(n);i++)
#define per(i,a,n) for (int i=(n)-1;i>=(int)(a);i--)
template<typename T> ostream& operator<<(ostream& _s, vector<T> _t) {rep(i, 0, _t.size()) _s << (i ? " " : "") << _t[i]; return _s;}
template<typename T> istream& operator>>(istream& _s, vector<T> &_t) {rep(i, 0, _t.size()) _s >> _t[i]; return _s;}
template<typename T, typename U> ostream& operator<<(ostream& _s, pair<T, U> _t) {_s << "(" << _t.first << "," << _t.second << ")"; return _s;}
template<typename T, typename U> istream& operator>>(istream& _s, pair<T, U> &_t) {_s >> _t.first >> _t.second; return _s;}
typedef long long ll;

int find(const vector<int>& v, int value, int fr, int to) {
    rep(i,fr,to+1) {
        if (v[i] == value) {
            return i;
        }
    }
    assert(false);
}

vector<int> invert(const vector<int>& v) {
    vector<int> res(v.size());
    rep(i,0,v.size()) {
        res[v[i]] = i;
    }
    return res;
}

int main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> p(n);
    cin >> p;
    rep(i,0,n) p[i]--;

    bool is_id = true;
    rep(i,0,n) {
        if (p[i] != i) is_id = false;
    }

    string base_s;
    rep(j,0,n) base_s += '.';
    vector<string> res(n);
    rep(i,0,n) res[i] = base_s;

    if (is_id) {
        cout << n << endl;
        rep(i,0,n) {
            cout << base_s << endl;
        }
        return 0;
    }

    p = invert(p);

    #ifdef LOCAL
    cout << p << endl;
    #endif

    int fr = 0, to = n-1;
    rep(row,0,n) {
        if (row == 0) {
            int mid = n / 2;
            int pos = find(p, mid, fr, to);

            rep(i,fr,pos+1) {
                res[row][i] = '\\';
            }
            per(i,fr,pos) {
                p[i+1] = p[i];
            }
            p[fr] = -1;

        } else {
            bool left = row % 2 == 1;
            int free_pos = left ? fr : to;
            assert(p[free_pos] == -1);
            int pos = find(p, free_pos, fr, to);

            if (left) {
                res[row][fr] = '/';
                rep(i,pos,to+1) {
                    res[row][i] = '/';
                }
                rep(i,pos,to) {
                    p[i] = p[i+1];
                }
                p[to] = -1;
                fr++;
            } else {
                res[row][to] = '\\';
                rep(i,fr,pos+1) {
                    res[row][i] = '\\';
                }
                per(i,fr,pos) {
                    p[i+1] = p[i];
                }
                p[fr] = -1;
                to--;
            }
        }

#ifdef LOCAL
        cout << res[row] << endl;
        cout << p << endl;
#endif
    }

    cout << (n-1) << endl;
    rep(i,0,n) {
        cout << res[i] << endl;
    }
}


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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  vector<int> pos(n);
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    pos[a - 1] = i;
  }

  int ans = 0;
  vector<bool> visited(n);
  vector<string> grid(n, string(n, '.'));
  for (int i = 0; i < n; ++i) {
    int u = i;
    while (!visited[u]) {
      visited[u] = true;

      int v = pos[u];
      char c = '.';
      if (u > v) {
        c = '/';
      } else if (v > u) {
        c = '\\';
      }

      if (!visited[v] || u == v) {
        ++ans;
        grid[n - ans][u] = c;
        grid[n - ans][v] = c;
      }

      u = v;
    }
  }

  cout << ans << "\n";
  for (string& i : grid) {
    cout << i << "\n";
  }
}


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

const int N = 1000;

bool visited[N];
string grid[N];
int perm[N];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;

  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    perm[a - 1] = i;
  }

  for (int i = 0; i < n; ++i) {
    grid[i] = string(n, '.');
  }

  bool ok = true;
  for (int i = 0; i < n; ++i) {
    ok &= (perm[i] == i);
  }

  int pre = n;
  int ans = (ok ? n : 0);
  if (!ok) {
    for (int i = n - 1; i >= 0; --i) {
      if (visited[i]) {
        continue;
      }

      int u = perm[i];
      visited[i] = true;
      grid[0][i] = '\\';
      if (pre < n) {
        ++ans;
        grid[n - ans][u] = '/';
        grid[n - ans][pre] = '/';
      }
      pre = i;

      while (u != i) {
        visited[u] = true;
        int v = perm[u];
        char c = (u > v ? '/' : '\\');
        ++ans;
        grid[n - ans][u] = c;
        grid[n - ans][v] = c;
        u = v;
      }
    }
  }

  cout << ans << "\n";
  for (int i = 0; i < n; ++i) {
    cout << grid[i] << "\n";
  }
}


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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

const char lf = '\n';

namespace ae86
{
	const int bufl = 1 << 15;

	char buf[bufl],*s=buf,*t=buf;

	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}

	inline int ty()
	{
		int a=0;int b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}
}
using ae86::ty;

const int _ = 1007;

int n,tar[_],via[_];
char mp[_];

int main()
{
	ios::sync_with_stdio(0),cout.tie(nullptr);

	n=ty();
	for(int i=1;i<=n;i++)tar[i]=ty(),via[tar[i]]=i;
	int got=0;
	for(int i=1;i<=n;i++)if(tar[i]!=i)got=1;
	cout<<n-got<<lf;

	for(int now=1;now<=n;now++)
	{
		mp[0]=mp[n+1]=0;
		for(int i=1;i<=n;i++)mp[i]='.';
		int ll=0,rr=0;
		for(int i=1;i<=n;i++)if(via[i]!=i)rr=i;
		for(int i=n;i>=1;i--)if(via[i]!=i)ll=i;
		if(ll!=rr)
		{
			if(via[ll]<=0)mp[rr]=mp[via[rr]]=mp[ll]='/',via[ll]=via[via[rr]],via[via[rr]]=via[rr],via[rr]=0;
			else mp[ll]=mp[via[ll]]=mp[rr]='\\',via[rr]=via[via[ll]],via[via[ll]]=via[ll],via[ll]=0;
		}
		cout<<(mp+1)<<lf;
	}

	return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
int n,i,j,a[1005],vis[1005],graph[1005][1005],ans=0,pos=0;
char s[5]="/.\\";
int main()
{
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&a[i]);
	for(i=1;i<=n;i++)
	{
		if(!vis[i])
		{
			if(a[i]==i)vis[i]=1,ans++;
			else
			{
				for(j=i;!vis[j];j=a[j])
				{
					vis[j]=1;
					if(!vis[a[j]])ans++,pos++,graph[pos][j]=graph[pos][a[j]]=j-a[j];
				}
			}
		}
	}
	printf("%d\n",ans);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(graph[i][j]==0)printf("%c",s[1]);
			if(graph[i][j]<0)printf("%c",s[0]);
			if(graph[i][j]>0)printf("%c",s[2]);
		}
		printf("\n");
	}
	return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
int n,i,j,a[1005],vis[1005],graph[1005][1005],ans=0,pos=0;
char s[5]="/*\\";
int main()
{
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&a[i]);
	for(i=1;i<=n;i++)
	{
		if(!vis[i])
		{
			if(a[i]==i)vis[i]=1,ans++;
			else
			{
				for(j=i;!vis[j];j=a[j])
				{
					vis[j]=1;
					if(!vis[a[j]])ans++,pos++,graph[pos][j]=graph[pos][a[j]]=j-a[j];
				}
			}
		}
	}
	printf("%d\n",ans);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(graph[i][j]==0)printf("%c",s[1]);
			if(graph[i][j]<0)printf("%c",s[0]);
			if(graph[i][j]>0)printf("%c",s[2]);
		}
		printf("\n");
	}
	return 0;
}


// I love meowmur
// We miss you, Arthur
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define mineq(a, b) (a) = ((a)>(b))?(b):(a)
#define maxeq(a, b) (a) = ((a)<(b))?(b):(a)
#define die(cond) if (cond) for (;;){}
#define y1 y_1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 2;
const ld eps = 1e-9;
const ld pi = acos(-1);

inline void solve(), read();

int main() {
	fast;
	read();
	solve();
	return 0;
}

ll n;
vll a;
vector<string> ans;
vector<vll> comps;
ll cn = -1;

void setout(ll x, ll& j) {
	if (x < a[x]) {
		ans[j][x] = '/';
		ans[j][a[x]] = '/';
	} else if (x > a[x]) {
		ans[j][x] = '\\';
		ans[j][a[x]] = '\\';
	}
}

void iter(ll ind, ll& j) {
	vll& cs = comps[ind];
	ll x = cs[sz(cs) - 2];
	if (x < a[x]) {
		ans[j][n - 1] = '\\';
		ans[j][a[cs.back()]] = '\\';
	} else if (x > a[x]) {
		ans[j][n - 1] = '/';
		ans[j][a[cs.back()]] = '/';
	} else {
		setout(cs.back(), j);
	}
	for (ll i = 0; i < sz(cs) - 1; i++) {
		++j;
		ll x = cs[i];
		setout(x, j);
	}
	x = cs[sz(cs) - 2];
	if (x < a[x]) {
		ans[j][n - 1] = '/';
	} else {
		ans[j][n - 1] = '\\';
	}
	++j;
}
void iter1(ll ind, ll& j) {
	ll x = comps[ind][0];
	setout(x, j);
	++j;
}
void itern(ll ind, ll& j) {
	vll& cs = comps[ind];
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
		++j;
	}
	ans[j][n - 1] = '\\';
	++j;
}

inline void solve() {
	vll used(n, 0);
	for (ll i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}
		used[i] = 1;
		comps.pb({});
		if (i == n - 1) {
			cn = sz(comps) - 1;
		}
		comps.back().pb(i);
		ll j = i;
		while (a[j] != i) {
			j = a[j];
			used[j] = 1;
			if (j == n - 1) {
				cn = sz(comps) - 1;
			}
			comps.back().pb(j);
		}
		if (sz(comps) - 1 == cn) {
			ll pos = -1;
			for (ll j = 0; j < sz(comps[cn]); j++) {
				if (comps[cn][j] == n - 1) {
					pos = j;
					break;
				}
			}
			vll temp;
			for (ll j = pos + 1; j < sz(comps[cn]); j++) {
				temp.pb(comps[cn][j]);
			}
			for (ll j = 0; j <= pos; j++) {
				temp.pb(comps[cn][j]);
			}
			comps[cn] = temp;
		}
	}
	ans.resize(n, string(n, '.'));
	ll j = 0;
	ll ok = 1;
	if (sz(comps[cn]) == 1) {
		iter1(cn, j);
	} else {
		ok = 0;
		itern(cn, j);
	}
	for (ll i = 0; i < sz(comps); i++) {
		if (i == cn) {
			continue;
		}
		if (sz(comps[i]) == 1) {
			iter1(i, j);
		} else if (cn == i) {
			ok = 0;
			itern(i, j);
		} else {
			ok = 0;
			iter(i, j);
		}
	}
	if (ok) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	for (string& s : ans) {
		cout << s << endl;
	}
}

inline void read() {
	cin >> n;
	a.resize(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		--a[i];
	}
}


// I love meowmur
// We miss you, Arthur
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define mineq(a, b) (a) = ((a)>(b))?(b):(a)
#define maxeq(a, b) (a) = ((a)<(b))?(b):(a)
#define die(cond) if (cond) for (;;){}
#define y1 y_1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 2;
const ld eps = 1e-9;
const ld pi = acos(-1);

inline void solve(), read();

int main() {
	fast;
	read();
	solve();
	return 0;
}

ll n;
vll a;
vector<string> ans;
vector<vll> comps;
ll cn = -1;

void setout(ll x, ll& j) {
	if (x < a[x]) {
		ans[j][x] = '/';
		ans[j][a[x]] = '/';
	} else if (x > a[x]) {
		ans[j][x] = '\\';
		ans[j][a[x]] = '\\';
	}
}

void iter(ll ind, ll& j) {
	vll& cs = comps[ind];
	ans[j][n - 1] = '\\';
	ans[j][a[cs.back()]] = '\\';
	++j;
	for (ll i = sz(cs) - 1; i >= 0; i--) {
		ll x = cs[i];
		setout(x, j);
		++j;
	}
	--j;
	ll x = cs.back();
	ans[j][n - 1] = '/';
	++j;
}
void iter1(ll ind, ll& j) {
	ll x = comps[ind][0];
	setout(x, j);
	++j;
}
void itern(ll ind, ll& j) {
	vll& cs = comps[ind];
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
		++j;
	}
	ans[j][n - 1] = '/';
	++j;
}

inline void solve() {
	vll used(n, 0);
	for (ll i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}
		used[i] = 1;
		comps.pb({});
		if (i == n - 1) {
			cn = sz(comps) - 1;
		}
		comps.back().pb(i);
		ll j = i;
		while (a[i] != j) {
			i = a[i];
			used[i] = 1;
			if (i == n - 1) {
				cn = sz(comps) - 1;
			}
			comps.back().pb(i);
		}
		if (sz(comps) - 1 == cn) {
			ll pos = -1;
			for (ll j = 0; j < sz(comps[cn]); j++) {
				if (comps[cn][j] == n - 1) {
					pos = j;
					break;
				}
			}
			vll temp;
			for (ll j = pos + 1; j < sz(comps[cn]); j++) {
				temp.pb(comps[cn][j]);
			}
			for (ll j = 0; j <= pos; j++) {
				temp.pb(comps[cn][j]);
			}
			comps[cn] = temp;
		}
	}
	ans.resize(n, string(n, '.'));
	ll j = 0;
	ll ok = 1;
	if (sz(comps[cn]) == 1) {
		iter1(cn, j);
	} else {
		ok = 0;
		itern(cn, j);
	}
	for (ll i = 0; i < sz(comps); i++) {
		if (i == cn) {
			continue;
		}
		if (sz(comps[i]) == 1) {
			iter1(i, j);
		} else if (cn == i) {
			ok = 0;
			itern(i, j);
		} else {
			ok = 0;
			iter(i, j);
		}
	}
	if (ok) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	for (string& s : ans) {
		cout << s << endl;
	}
}

inline void read() {
	cin >> n;
	a.resize(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		--a[i];
	}
}


// I love meowmur
// We miss you, Arthur
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define mineq(a, b) (a) = ((a)>(b))?(b):(a)
#define maxeq(a, b) (a) = ((a)<(b))?(b):(a)
#define die(cond) if (cond) for (;;){}
#define y1 y_1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 2;
const ld eps = 1e-9;
const ld pi = acos(-1);

inline void solve(), read();

int main() {
	fast;
	read();
	solve();
	return 0;
}

ll n;
vll a;
vector<string> ans;
vector<vll> comps;
ll cn = -1;

void setout(ll x, ll& j) {
	if (x < a[x]) {
		ans[j][x] = '/';
		ans[j][a[x]] = '/';
	} else if (x > a[x]) {
		ans[j][x] = '\\';
		ans[j][a[x]] = '\\';
	}
}

void iter(ll ind, ll& j) {
	vll& cs = comps[ind];
	ans[j][n - 1] = '\\';
	ans[j][a[cs.back()]] = '\\';
	++j;
	for (ll i = sz(cs) - 2; i >= 0; i--) {
		ll x = cs[i];
		setout(x, j);
		++j;
	}
	--j;
	ll x = cs.back();
	ans[j][n - 1] = '/';
	++j;
}
void iter1(ll ind, ll& j) {
	ll x = comps[ind][0];
	setout(x, j);
	++j;
}
void itern(ll ind, ll& j) {
	vll& cs = comps[ind];
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
		++j;
	}
	ans[j][n - 1] = '/';
	++j;
}

inline void solve() {
	vll used(n, 0);
	for (ll i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}
		used[i] = 1;
		comps.pb({});
		if (i == n - 1) {
			cn = sz(comps) - 1;
		}
		comps.back().pb(i);
		ll j = i;
		while (a[i] != j) {
			i = a[i];
			used[i] = 1;
			if (i == n - 1) {
				cn = sz(comps) - 1;
			}
			comps.back().pb(i);
		}
		if (sz(comps) - 1 == cn) {
			ll pos = -1;
			for (ll j = 0; j < sz(comps[cn]); j++) {
				if (comps[cn][j] == n - 1) {
					pos = j;
					break;
				}
			}
			vll temp;
			for (ll j = pos + 1; j < sz(comps[cn]); j++) {
				temp.pb(comps[cn][j]);
			}
			for (ll j = 0; j <= pos; j++) {
				temp.pb(comps[cn][j]);
			}
			comps[cn] = temp;
		}
	}
	ans.resize(n, string(n, '.'));
	ll j = 0;
	ll ok = 1;
	if (sz(comps[cn]) == 1) {
		iter1(cn, j);
	} else {
		ok = 0;
		itern(cn, j);
	}
	for (ll i = 0; i < sz(comps); i++) {
		if (i == cn) {
			continue;
		}
		if (sz(comps[i]) == 1) {
			iter1(i, j);
		} else if (cn == i) {
			ok = 0;
			itern(i, j);
		} else {
			ok = 0;
			iter(i, j);
		}
	}
	if (ok) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	for (string& s : ans) {
		cout << s << endl;
	}
}

inline void read() {
	cin >> n;
	a.resize(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		--a[i];
	}
}


// I love meowmur
// We miss you, Arthur
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define mineq(a, b) (a) = ((a)>(b))?(b):(a)
#define maxeq(a, b) (a) = ((a)<(b))?(b):(a)
#define die(cond) if (cond) for (;;){}
#define y1 y_1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 2;
const ld eps = 1e-9;
const ld pi = acos(-1);

inline void solve(), read();

int main() {
	fast;
	read();
	solve();
	return 0;
}

ll n;
vll a;
vector<string> ans;
vector<vll> comps;
ll cn = -1;

void setout(ll x, ll& j) {
	if (x < a[x]) {
		ans[j][x] = '/';
		ans[j][a[x]] = '/';
	} else if (x > a[x]) {
		ans[j][x] = '\\';
		ans[j][a[x]] = '\\';
	}
}

void iter(ll ind, ll& j) {
	vll& cs = comps[ind];
	ans[j][n - 1] = '\\';
	ans[j][a[cs.back()]] = '\\';
	for (ll i = 0; i < sz(cs) - 1; i++) {
		++j;
		ll x = cs[i];
		setout(x, j);
	}
	ll x = cs.back();
	ans[j][n - 1] = '/';
	++j;
}
void iter1(ll ind, ll& j) {
	ll x = comps[ind][0];
	setout(x, j);
	++j;
}
void itern(ll ind, ll& j) {
	vll& cs = comps[ind];
	for (ll i = 0; i < sz(cs) - 1; i++) {
		++j;
		ll x = cs[i];
		setout(x, j);
	}
	ans[j][n - 1] = '/';
	++j;
}

inline void solve() {
	vll used(n, 0);
	for (ll i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}
		used[i] = 1;
		comps.pb({});
		if (i == n - 1) {
			cn = sz(comps) - 1;
		}
		comps.back().pb(i);
		ll j = i;
		while (a[i] != j) {
			i = a[i];
			used[i] = 1;
			if (i == n - 1) {
				cn = sz(comps) - 1;
			}
			comps.back().pb(i);
		}
		if (sz(comps) - 1 == cn) {
			ll pos = -1;
			for (ll j = 0; j < sz(comps[cn]); j++) {
				if (comps[cn][j] == n - 1) {
					pos = j;
					break;
				}
			}
			vll temp;
			for (ll j = pos + 1; j < sz(comps[cn]); j++) {
				temp.pb(comps[cn][j]);
			}
			for (ll j = 0; j <= pos; j++) {
				temp.pb(comps[cn][j]);
			}
			comps[cn] = temp;
		}
	}
	ans.resize(n, string(n, '.'));
	ll j = 0;
	ll ok = 1;
	for (ll i = 0; i < sz(comps); i++) {
		if (i == cn) {
			continue;
		}
		if (sz(comps[i]) == 1) {
			iter1(i, j);
		} else if (cn == i) {
			ok = 0;
			itern(i, j);
		} else {
			ok = 0;
			iter(i, j);
		}
	}
	if (ok && sz(comps[cn]) == 1) {
		iter1(cn, j);
	} else {
		ok = 0;
		itern(cn, j);
	}
	if (ok) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	for (string& s : ans) {
		cout << s << endl;
	}
}

inline void read() {
	cin >> n;
	a.resize(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		--a[i];
	}
}


// I love meowmur
// We miss you, Arthur
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define mineq(a, b) (a) = ((a)>(b))?(b):(a)
#define maxeq(a, b) (a) = ((a)<(b))?(b):(a)
#define die(cond) if (cond) for (;;){}
#define y1 y_1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 2;
const ld eps = 1e-9;
const ld pi = acos(-1);

inline void solve(), read();

int main() {
	fast;
	read();
	solve();
	return 0;
}

ll n;
vll a;
vector<string> ans;
vector<vll> comps;
ll cn = -1;

void setout(ll x, ll& j) {
	if (x < a[x]) {
		ans[j][x] = '/';
		ans[j][a[x]] = '/';
	} else if (x > a[x]) {
		ans[j][x] = '\\';
		ans[j][a[x]] = '\\';
	}
}

void iter(ll ind, ll& j) {
	vll& cs = comps[ind];
	ans[j][n - 1] = '\\';
	ans[j][a[cs.back()]] = '\\';
	for (ll i = 0; i < sz(cs) - 1; i++) {
		++j;
		ll x = cs[i];
		setout(x, j);
	}
	ll x = cs.back();
	ans[j][n - 1] = '/';
	++j;
}
void iter1(ll ind, ll& j) {
	ll x = comps[ind][0];
	setout(x, j);
	++j;
}
void itern(ll ind, ll& j) {
	vll& cs = comps[ind];
	for (ll i = 0; i < sz(cs) - 1; i++) {
		++j;
		ll x = cs[i];
		setout(x, j);
	}
	ans[j][n - 1] = '/';
	++j;
}

inline void solve() {
	vll used(n, 0);
	for (ll i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}
		used[i] = 1;
		comps.pb({});
		if (i == n - 1) {
			cn = sz(comps) - 1;
		}
		comps.back().pb(i);
		ll j = i;
		while (a[i] != j) {
			i = a[i];
			used[i] = 1;
			if (i == n - 1) {
				cn = sz(comps) - 1;
			}
			comps.back().pb(i);
		}
		if (sz(comps) - 1 == cn) {
			ll pos = -1;
			for (ll j = 0; j < sz(comps[cn]); j++) {
				if (comps[cn][j] == n - 1) {
					pos = j;
					break;
				}
			}
			vll temp;
			for (ll j = pos + 1; j < sz(comps[cn]); j++) {
				temp.pb(comps[cn][j]);
			}
			for (ll j = 0; j <= pos; j++) {
				temp.pb(comps[cn][j]);
			}
			comps[cn] = temp;
		}
	}
	ans.resize(n, string(n, '.'));
	ll j = 0;
	ll ok = 1;
	for (ll i = 0; i < sz(comps); i++) {
		if (i == cn) {
			continue;
		}
		if (sz(comps[i]) == 1) {
			iter1(i, j);
		} else if (cn == i) {
			ok = 0;
			itern(i, j);
		} else {
			ok = 0;
			iter(i, j);
		}
	}
	if (ok && sz(comps[cn]) == 1) {
		iter1(cn, j);
	} else {
		itern(cn, j);
	}
	if (ok) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	for (string& s : ans) {
		cout << s << endl;
	}
}

inline void read() {
	cin >> n;
	a.resize(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		--a[i];
	}
}


// I love meowmur
// We miss you, Arthur
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define mineq(a, b) (a) = ((a)>(b))?(b):(a)
#define maxeq(a, b) (a) = ((a)<(b))?(b):(a)
#define die(cond) if (cond) for (;;){}
#define y1 y_1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 2;
const ld eps = 1e-9;
const ld pi = acos(-1);

inline void solve(), read();

int main() {
	fast;
	read();
	solve();
	return 0;
}

ll n;
vll a;
vector<string> ans;
vector<vll> comps;
ll cn = -1;

void setout(ll x, ll& j) {
	if (x < a[x]) {
		ans[j][x] = '/';
		ans[j][a[x]] = '/';
	} else if (x > a[x]) {
		ans[j][x] = '\\';
		ans[j][a[x]] = '\\';
	}
}

void iter(ll ind, ll& j) {
	vll& cs = comps[ind];
	ll x = cs[sz(cs) - 2];
	if (x <= a[x]) {
		ans[j][n - 1] = '\\';
		ans[j][a[cs.back()]] = '\\';
	} else {
		ans[j][n - 1] = '/';
		ans[j][a[cs.back()]] = '/';
	}
	for (ll i = 0; i < sz(cs) - 1; i++) {
		++j;
		ll x = cs[i];
		setout(x, j);
	}
	x = cs[sz(cs) - 2];
	if (x <= a[x]) {
		ans[j][n - 1] = '/';
	} else {
		ans[j][n - 1] = '\\';
	}
	++j;
}
void iter1(ll ind, ll& j) {
	ll x = comps[ind][0];
	setout(x, j);
	++j;
}
void itern(ll ind, ll& j) {
	vll& cs = comps[ind];
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
		++j;
	}
	ans[j][n - 1] = '\\';
	++j;
}

inline void solve() {
	vll used(n, 0);
	for (ll i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}
		used[i] = 1;
		comps.pb({});
		if (i == n - 1) {
			cn = sz(comps) - 1;
		}
		comps.back().pb(i);
		ll j = i;
		while (a[j] != i) {
			j = a[j];
			used[j] = 1;
			if (j == n - 1) {
				cn = sz(comps) - 1;
			}
			comps.back().pb(j);
		}
		if (sz(comps) - 1 == cn) {
			ll pos = -1;
			for (ll j = 0; j < sz(comps[cn]); j++) {
				if (comps[cn][j] == n - 1) {
					pos = j;
					break;
				}
			}
			vll temp;
			for (ll j = pos + 1; j < sz(comps[cn]); j++) {
				temp.pb(comps[cn][j]);
			}
			for (ll j = 0; j <= pos; j++) {
				temp.pb(comps[cn][j]);
			}
			comps[cn] = temp;
		}
	}
	ans.resize(n, string(n, '.'));
	ll j = 0;
	ll ok = 1;
	if (sz(comps[cn]) == 1) {
		iter1(cn, j);
	} else {
		ok = 0;
		itern(cn, j);
	}
	for (ll i = 0; i < sz(comps); i++) {
		if (i == cn) {
			continue;
		}
		if (sz(comps[i]) == 1) {
			iter1(i, j);
		} else if (cn == i) {
			ok = 0;
			itern(i, j);
		} else {
			ok = 0;
			iter(i, j);
		}
	}
	if (ok) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	for (string& s : ans) {
		cout << s << endl;
	}
}

inline void read() {
	cin >> n;
	a.resize(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		--a[i];
	}
}


// I love meowmur
// We miss you, Arthur
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define mineq(a, b) (a) = ((a)>(b))?(b):(a)
#define maxeq(a, b) (a) = ((a)<(b))?(b):(a)
#define die(cond) if (cond) for (;;){}
#define y1 y_1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 2;
const ld eps = 1e-9;
const ld pi = acos(-1);

inline void solve(), read();

int main() {
	fast;
	read();
	solve();
	return 0;
}

ll n;
vll a;
vector<string> ans;
vector<vll> comps;
ll cn = -1;

void setout(ll x, ll& j) {
	if (x < a[x]) {
		ans[j][x] = '/';
		ans[j][a[x]] = '/';
	} else if (x > a[x]) {
		ans[j][x] = '\\';
		ans[j][a[x]] = '\\';
	}
}

void iter(ll ind, ll& j) {
	vll& cs = comps[ind];
	ans[j][n - 1] = '\\';
	ans[j][a[cs.back()]] = '\\';
	for (ll i = 0; i < sz(cs) - 1; i++) {
		++j;
		ll x = cs[i];
		setout(x, j);
	}
	ll x = cs.back();
	ans[j][n - 1] = '/';
	++j;
}
void iter1(ll ind, ll& j) {
	ll x = comps[ind][0];
	setout(x, j);
	++j;
}
void itern(ll ind, ll& j) {
	vll& cs = comps[ind];
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
		++j;
	}
	ans[j][n - 1] = '/';
	++j;
}

inline void solve() {
	vll used(n, 0);
	for (ll i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}
		used[i] = 1;
		comps.pb({});
		if (i == n - 1) {
			cn = sz(comps) - 1;
		}
		comps.back().pb(i);
		ll j = i;
		while (a[j] != i) {
			j = a[j];
			used[j] = 1;
			if (j == n - 1) {
				cn = sz(comps) - 1;
			}
			comps.back().pb(j);
		}
		if (sz(comps) - 1 == cn) {
			ll pos = -1;
			for (ll j = 0; j < sz(comps[cn]); j++) {
				if (comps[cn][j] == n - 1) {
					pos = j;
					break;
				}
			}
			vll temp;
			for (ll j = pos + 1; j < sz(comps[cn]); j++) {
				temp.pb(comps[cn][j]);
			}
			for (ll j = 0; j <= pos; j++) {
				temp.pb(comps[cn][j]);
			}
			comps[cn] = temp;
		}
	}
	ans.resize(n, string(n, '.'));
	ll j = 0;
	ll ok = 1;
	if (sz(comps[cn]) == 1) {
		iter1(cn, j);
	} else {
		ok = 0;
		itern(cn, j);
	}
	for (ll i = 0; i < sz(comps); i++) {
		if (i == cn) {
			continue;
		}
		if (sz(comps[i]) == 1) {
			iter1(i, j);
		} else if (cn == i) {
			ok = 0;
			itern(i, j);
		} else {
			ok = 0;
			iter(i, j);
		}
	}
	if (ok) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	for (string& s : ans) {
		cout << s << endl;
	}
}

inline void read() {
	cin >> n;
	a.resize(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		--a[i];
	}
}


// I love meowmur
// We miss you, Arthur
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define mineq(a, b) (a) = ((a)>(b))?(b):(a)
#define maxeq(a, b) (a) = ((a)<(b))?(b):(a)
#define die(cond) if (cond) for (;;){}
#define y1 y_1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 2;
const ld eps = 1e-9;
const ld pi = acos(-1);

inline void solve(), read();

int main() {
	fast;
	read();
	solve();
	return 0;
}

ll n;
vll a;
vector<string> ans;
vector<vll> comps;
ll cn = -1;

void setout(ll x, ll& j) {
	if (x < a[x]) {
		ans[j][x] = '/';
		ans[j][a[x]] = '/';
	} else if (x > a[x]) {
		ans[j][x] = '\\';
		ans[j][a[x]] = '\\';
	}
	++j;
}

void iter(ll ind, ll& j) {
	vll& cs = comps[ind];
	ans[j][n - 1] = '/';
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
	}
	ll x = cs.back();
	ans[j][n - 1] = '\\';
	ans[j][a[x]] = '\\';
	++j;
}
void iter1(ll ind, ll& j) {
	ll x = comps[ind][0];
	setout(x, j);
}
void itern(ll ind, ll& j) {
	vll& cs = comps[ind];
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
	}
	ans[j][n - 1] = '/';
	++j;
}

inline void solve() {
	vll used(n, 0);
	for (ll i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}
		used[i] = 1;
		comps.pb({});
		if (i == n - 1) {
			cn = sz(comps) - 1;
		}
		comps.back().pb(i);
		ll j = i;
		while (a[i] != j) {
			i = a[i];
			used[i] = 1;
			if (i == n - 1) {
				cn = sz(comps) - 1;
			}
			comps.back().pb(i);
		}
		if (i == cn) {
			ll pos = -1;
			for (ll j = 0; j < n; j++) {
				if (comps[i][j] == n - 1) {
					pos = j;
					break;
				}
			}
			vll temp;
			for (ll j = pos + 1; j < n; j++) {
				temp.pb(j);
			}
			for (ll j = 0; j <= pos; j++) {
				temp.pb(j);
			}
			comps[i] = temp;
		}
	}
	ans.resize(n, string(n, '.'));
	ll j = 0;
	ll ok = 1;
	for (ll i = 0; i < sz(comps); i++) {
		if (sz(comps[i]) == 1) {
			iter1(i, j);
		} else if (cn == i) {
			ok = 0;
			itern(i, j);
		} else {
			ok = 0;
			iter(i, j);
		}
	}
	if (ok) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	for (string& s : ans) {
		cout << s << endl;
	}
}

inline void read() {
	cin >> n;
	a.resize(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		--a[i];
	}
}


// I love meowmur
// We miss you, Arthur
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define mineq(a, b) (a) = ((a)>(b))?(b):(a)
#define maxeq(a, b) (a) = ((a)<(b))?(b):(a)
#define die(cond) if (cond) for (;;){}
#define y1 y_1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 2;
const ld eps = 1e-9;
const ld pi = acos(-1);

inline void solve(), read();

int main() {
	fast;
	read();
	solve();
	return 0;
}

ll n;
vll a;
vector<string> ans;
vector<vll> comps;
ll cn = -1;

void setout(ll x, ll& j) {
	if (x < a[x]) {
		ans[j][x] = '/';
		ans[j][a[x]] = '/';
	} else if (x > a[x]) {
		ans[j][x] = '\\';
		ans[j][a[x]] = '\\';
	}
	++j;
}

void iter(ll ind, ll& j) {
	vll& cs = comps[ind];
	ans[j][n - 1] = '/';
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
	}
	ll x = cs.back();
	ans[j][n - 1] = '\\';
	ans[j][a[x]] = '\\';
	++j;
}
void iter1(ll ind, ll& j) {
	ll x = comps[ind][0];
	setout(x, j);
}
void itern(ll ind, ll& j) {
	vll& cs = comps[ind];
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
	}
	ans[j][n - 1] = '/';
	++j;
}

inline void solve() {
	vll used(n, 0);
	for (ll i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}
		used[i] = 1;
		comps.pb({});
		if (i == n - 1) {
			cn = sz(comps) - 1;
		}
		comps.back().pb(i);
		ll j = i;
		while (a[i] != j) {
			i = a[i];
			used[i] = 1;
			if (i == n - 1) {
				cn = sz(comps) - 1;
			}
			comps.back().pb(i);
		}
		if (sz(comps) - 1 == cn) {
			ll pos = -1;
			for (ll j = 0; j < sz(comps[cn]); j++) {
				if (comps[cn][j] == n - 1) {
					pos = j;
					break;
				}
			}
			vll temp;
			for (ll j = pos + 1; j < sz(comps[cn]); j++) {
				temp.pb(comps[cn][j]);
			}
			for (ll j = 0; j <= pos; j++) {
				temp.pb(comps[cn][j]);
			}
			comps[cn] = temp;
		}
	}
	ans.resize(n, string(n, '.'));
	ll j = 0;
	ll ok = 1;
	for (ll i = 0; i < sz(comps); i++) {
		if (sz(comps[i]) == 1) {
			iter1(i, j);
		} else if (cn == i) {
			ok = 0;
			itern(i, j);
		} else {
			ok = 0;
			iter(i, j);
		}
	}
	if (ok) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	reverse(all(ans));
	for (string& s : ans) {
		cout << s << endl;
	}
}

inline void read() {
	cin >> n;
	a.resize(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		--a[i];
	}
}


// I love meowmur
// We miss you, Arthur
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define mineq(a, b) (a) = ((a)>(b))?(b):(a)
#define maxeq(a, b) (a) = ((a)<(b))?(b):(a)
#define die(cond) if (cond) for (;;){}
#define y1 y_1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 2;
const ld eps = 1e-9;
const ld pi = acos(-1);

inline void solve(), read();

int main() {
	fast;
	read();
	solve();
	return 0;
}

ll n;
vll a;
vector<string> ans;
vector<vll> comps;
ll cn = -1;

void setout(ll x, ll& j) {
	if (x < a[x]) {
		ans[j][x] = '/';
		ans[j][a[x]] = '/';
	} else if (x > a[x]) {
		ans[j][x] = '\\';
		ans[j][a[x]] = '\\';
	}
	++j;
}

void iter(ll ind, ll& j) {
	vll& cs = comps[ind];
	ans[j][n - 1] = '/';
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
	}
	ll x = cs.back();
	ans[j][n - 1] = '\\';
	ans[j][a[x]] = '\\';
	++j;
}
void iter1(ll ind, ll& j) {
	ll x = comps[ind][0];
	setout(x, j);
}
void itern(ll ind, ll& j) {
	vll& cs = comps[ind];
	sort(all(cs));
	ans[j][n - 1] = '/';
	++j;
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
	}
}

inline void solve() {
	vll used(n, 0);
	for (ll i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}
		used[i] = 1;
		comps.pb({});
		if (i == n - 1) {
			cn = sz(comps) - 1;
		}
		comps.back().pb(i);
		ll j = i;
		while (a[i] != j) {
			i = a[i];
			used[i] = 1;
			if (i == n - 1) {
				cn = sz(comps) - 1;
			}
			comps.back().pb(i);
		}
	}
	ans.resize(n, string(n, '.'));
	ll j = 0;
	ll ok = 1;
	for (ll i = 0; i < sz(comps); i++) {
		if (sz(comps[i]) == 1) {
			iter1(i, j);
		} else if (cn == i) {
			ok = 0;
			itern(i, j);
		} else {
			ok = 1;
			iter(i, j);
		}
	}
	if (ok) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	reverse(all(ans));
	for (string& s : ans) {
		cout << s << endl;
	}
}

inline void read() {
	cin >> n;
	a.resize(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		--a[i];
	}
}


// I love meowmur
// We miss you, Arthur
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(a) (a).begin(), (a).end()
#define sz(a) (ll)((a).size())
#define heap priority_queue
#define hash_map unordered_map
#define hash_set unordered_set
#define ft first
#define sd second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define mineq(a, b) (a) = ((a)>(b))?(b):(a)
#define maxeq(a, b) (a) = ((a)<(b))?(b):(a)
#define die(cond) if (cond) for (;;){}
#define y1 y_1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<ll> vll;
typedef set<ll> sll;
typedef map<ll, ll> mll;
const ll inf = numeric_limits<ll>::max() / 2;
const ld eps = 1e-9;
const ld pi = acos(-1);

inline void solve(), read();

int main() {
	fast;
	read();
	solve();
	return 0;
}

ll n;
vll a;
vector<string> ans;
vector<vll> comps;
ll cn = -1;

void setout(ll x, ll& j) {
	if (x < a[x]) {
		ans[j][x] = '/';
		ans[j][a[x]] = '/';
	} else if (x > a[x]) {
		ans[j][x] = '\\';
		ans[j][a[x]] = '\\';
	}
	++j;
}

void iter(ll ind, ll& j) {
	vll& cs = comps[ind];
	ans[j][n - 1] = '/';
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
	}
	ll x = cs.back();
	ans[j][n - 1] = '\\';
	ans[j][a[x]] = '\\';
	++j;
}
void iter1(ll ind, ll& j) {
	ll x = comps[ind][0];
	setout(x, j);
}
void itern(ll ind, ll& j) {
	vll& cs = comps[ind];
	for (ll i = 0; i < sz(cs) - 1; i++) {
		ll x = cs[i];
		setout(x, j);
	}
	ans[j][n - 1] = '/';
	++j;
}

inline void solve() {
	vll used(n, 0);
	for (ll i = 0; i < n; i++) {
		if (used[i]) {
			continue;
		}
		used[i] = 1;
		comps.pb({});
		if (i == n - 1) {
			cn = sz(comps) - 1;
		}
		comps.back().pb(i);
		ll j = i;
		while (a[i] != j) {
			i = a[i];
			used[i] = 1;
			if (i == n - 1) {
				cn = sz(comps) - 1;
			}
			comps.back().pb(i);
		}
		if (sz(comps) - 1 == cn) {
			ll pos = -1;
			for (ll j = 0; j < sz(comps[cn]); j++) {
				if (comps[cn][j] == n - 1) {
					pos = j;
					break;
				}
			}
			vll temp;
			for (ll j = pos + 1; j < sz(comps[cn]); j++) {
				temp.pb(comps[cn][j]);
			}
			for (ll j = 0; j <= pos; j++) {
				temp.pb(comps[cn][j]);
			}
			comps[cn] = temp;
		}
	}
	ans.resize(n, string(n, '.'));
	ll j = 0;
	ll ok = 1;
	for (ll i = 0; i < sz(comps); i++) {
		if (sz(comps[i]) == 1) {
			iter1(i, j);
		} else if (cn == i) {
			ok = 0;
			itern(i, j);
		} else {
			ok = 0;
			iter(i, j);
		}
	}
	if (ok) {
		cout << n << endl;
	} else {
		cout << n - 1 << endl;
	}
	for (string& s : ans) {
		cout << s << endl;
	}
}

inline void read() {
	cin >> n;
	a.resize(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		--a[i];
	}
}