#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// U1, D1, U2, D2, D1, U1, U2, D3, U3, U2, U3, D3, U2

/*
N = 2
U2, U1, D1, U2, D2, D1, U1, D2

N = 3
U3, U2, U1, D1, U2, D2, D1, U1, D2, U3, D3, D2, U1, D1, D2, U2, D1, U1, U2, D3
-->                                 <---->                                  <--

S -> UN, S, UN, DN, rev(S), DN

L -> 2L+4

O(2^N)

{0, 3, 4} -> NO     S1
{1, 3} -> NO        S2

S1 + S2

{0, 2, 3} -> YES
* */

void impossible() {
	puts("Impossible");
	exit(0);
}

const int UP = 0, DOWN = 1;
vector<pair<int,int>> rec(vector<int> group) {
	if(group.empty()) {
		return {};
	}
	int last = group.back();
	group.pop_back();
	vector<pair<int,int>> s = rec(group);
	// S -> UN, S, UN, DN, rev(S), DN
	vector<pair<int,int>> total;
	if(!s.empty()) total.emplace_back(last, UP);
	for(auto p : s) {
		total.push_back(p);
	}
	total.emplace_back(last, UP);
	total.emplace_back(last, DOWN);
	reverse(s.begin(), s.end());
	for(auto p : s) {
		total.push_back(p);
	}
	if(!s.empty()) total.emplace_back(last, DOWN);
	return total;
}

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<bool> possible(1 << n);
	for(int mask = 0; mask < (1 << n); ++mask) {
		possible[mask] = (s[mask] == '1');
	}
	// minimal subsets that give answer NO
	vector<int> minimal;
	for(int mask = 0; mask < (1 << n); ++mask) {
		if(!possible[mask]) {
			bool is_minimal = true;
			for(int bit = 0; bit < n; ++bit) {
				if(mask & (1 << bit)) {
					if(!possible[mask ^ (1 << bit)]) {
						is_minimal = false;
					}
				}
			}
			if(is_minimal) {
				minimal.push_back(mask);
			}
		}
	}
	for(int x : minimal) {
		for(int y : minimal) {
			if(x != y && ((x & y) == y)) {
				impossible();
			}
		}
	}
	for(int mask = 0; mask < (1 << n); ++mask) {
		bool contains = false;
		for(int x : minimal) {
			if((mask & x) == x) {
				contains = true;
			}
		}
		if(contains == possible[mask]) {
			impossible();
		}
	}
	puts("Possible");
	debug() << imie(minimal);
	pair<int,int> me{0, 0};
	vector<pair<int,int>> answer;
	answer.push_back(me);
	auto f = [&](int x, int y) {
		assert(me.first == x || me.second == y);
		assert(me != make_pair(x, y));
		for(int i = me.first + 1; i < x; ++i) {
			answer.emplace_back(i, me.second);
		}
		for(int i = me.first - 1; i > x; --i) {
			answer.emplace_back(i, me.second);
		}
		me = {x, y};
		answer.push_back(me);
	};
	for(int mask : minimal) {
		vector<int> group;
		for(int bit = 0; bit < n; ++bit) {
			if(mask & (1 << bit)) {
				group.push_back(bit);
			}
		}
		reverse(group.begin(), group.end());
		vector<pair<int,int>> moves = rec(group);
		debug() << imie(moves);
		for(pair<int,int> move : moves) {
			int x = move.first;
			int type = move.second;
			if(me.first < x) {
				f(x, 0);
			}
			else if(me.first > x + 1) {
				f(x + 1, 0);
			}
			if(type == UP) {
				f(me.first, 1);
				f(x + x + 1 - me.first, 1);
				f(me.first, 0);
			}
			else {
				f(x + x + 1 - me.first, 0);
			}
		}
		if(me != make_pair(0, 0)) {
			f(0, 0);
		}
	}
	printf("%d\n", (int) answer.size() - 1);
	for(pair<int,int> p : answer) {
		printf("%d %d\n", p.first, p.second);
	}
}

// U1, U0, D0, U1, D1, D0, U0, D1

### Prompt

Please provide a cpp coded solution to the problem described below:

Given are a positive integer N and a sequence of length 2^N consisting of 0s and 1s: A_0,A_1,\ldots,A_{2^N-1}. Determine whether there exists a closed curve C that satisfies the condition below for all 2^N sets S \subseteq \\{0,1,\ldots,N-1 \\}. If the answer is yes, construct one such closed curve.

* Let x = \sum_{i \in S} 2^i and B_S be the set of points \\{ (i+0.5,0.5) | i \in S \\}.
* If there is a way to continuously move the closed curve C without touching B_S so that every point on the closed curve has a negative y-coordinate, A_x = 1.
* If there is no such way, A_x = 0.



For instruction on printing a closed curve, see Output below.

Constraints

* 1 \leq N \leq 8
* A_i = 0,1 \quad (0 \leq i \leq 2^N-1)
* A_0 = 1

Input

Input is given from Standard Input in the following format:


N
A_0A_1 \cdots A_{2^N-1}


Output

If there is no closed curve that satisfies the condition, print `Impossible`.

If such a closed curve exists, print `Possible` in the first line. Then, print one such curve in the following format:


L
x_0 y_0
x_1 y_1
:
x_L y_L


This represents the closed polyline that passes (x_0,y_0),(x_1,y_1),\ldots,(x_L,y_L) in this order.

Here, all of the following must be satisfied:

* 0 \leq x_i \leq N, 0 \leq y_i \leq 1, and x_i, y_i are integers. (0 \leq i \leq L)
* |x_i-x_{i+1}| + |y_i-y_{i+1}| = 1. (0 \leq i \leq L-1)
* (x_0,y_0) = (x_L,y_L).



Additionally, the length of the closed curve L must satisfy 0 \leq L \leq 250000.

It can be proved that, if there is a closed curve that satisfies the condition in Problem Statement, there is also a closed curve that can be expressed in this format.

Examples

Input

1
10


Output

Possible
4
0 0
0 1
1 1
1 0
0 0


Input

2
1000


Output

Possible
6
1 0
2 0
2 1
1 1
0 1
0 0
1 0


Input

2
1001


Output

Impossible


Input

1
11


Output

Possible
0
1 1

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// U1, D1, U2, D2, D1, U1, U2, D3, U3, U2, U3, D3, U2

/*
N = 2
U2, U1, D1, U2, D2, D1, U1, D2

N = 3
U3, U2, U1, D1, U2, D2, D1, U1, D2, U3, D3, D2, U1, D1, D2, U2, D1, U1, U2, D3
-->                                 <---->                                  <--

S -> UN, S, UN, DN, rev(S), DN

L -> 2L+4

O(2^N)

{0, 3, 4} -> NO     S1
{1, 3} -> NO        S2

S1 + S2

{0, 2, 3} -> YES
* */

void impossible() {
	puts("Impossible");
	exit(0);
}

const int UP = 0, DOWN = 1;
vector<pair<int,int>> rec(vector<int> group) {
	if(group.empty()) {
		return {};
	}
	int last = group.back();
	group.pop_back();
	vector<pair<int,int>> s = rec(group);
	// S -> UN, S, UN, DN, rev(S), DN
	vector<pair<int,int>> total;
	if(!s.empty()) total.emplace_back(last, UP);
	for(auto p : s) {
		total.push_back(p);
	}
	total.emplace_back(last, UP);
	total.emplace_back(last, DOWN);
	reverse(s.begin(), s.end());
	for(auto p : s) {
		total.push_back(p);
	}
	if(!s.empty()) total.emplace_back(last, DOWN);
	return total;
}

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<bool> possible(1 << n);
	for(int mask = 0; mask < (1 << n); ++mask) {
		possible[mask] = (s[mask] == '1');
	}
	// minimal subsets that give answer NO
	vector<int> minimal;
	for(int mask = 0; mask < (1 << n); ++mask) {
		if(!possible[mask]) {
			bool is_minimal = true;
			for(int bit = 0; bit < n; ++bit) {
				if(mask & (1 << bit)) {
					if(!possible[mask ^ (1 << bit)]) {
						is_minimal = false;
					}
				}
			}
			if(is_minimal) {
				minimal.push_back(mask);
			}
		}
	}
	for(int x : minimal) {
		for(int y : minimal) {
			if(x != y && ((x & y) == y)) {
				impossible();
			}
		}
	}
	for(int mask = 0; mask < (1 << n); ++mask) {
		bool contains = false;
		for(int x : minimal) {
			if((mask & x) == x) {
				contains = true;
			}
		}
		if(contains == possible[mask]) {
			impossible();
		}
	}
	puts("Possible");
	debug() << imie(minimal);
	pair<int,int> me{0, 0};
	vector<pair<int,int>> answer;
	answer.push_back(me);
	auto f = [&](int x, int y) {
		assert(me.first == x || me.second == y);
		assert(me != make_pair(x, y));
		for(int i = me.first + 1; i < x; ++i) {
			answer.emplace_back(i, me.second);
		}
		for(int i = me.first - 1; i > x; --i) {
			answer.emplace_back(i, me.second);
		}
		me = {x, y};
		answer.push_back(me);
	};
	for(int mask : minimal) {
		vector<int> group;
		for(int bit = 0; bit < n; ++bit) {
			if(mask & (1 << bit)) {
				group.push_back(bit);
			}
		}
		reverse(group.begin(), group.end());
		vector<pair<int,int>> moves = rec(group);
		debug() << imie(moves);
		for(pair<int,int> move : moves) {
			int x = move.first;
			int type = move.second;
			if(me.first < x) {
				f(x, 0);
			}
			else if(me.first > x + 1) {
				f(x + 1, 0);
			}
			if(type == UP) {
				f(me.first, 1);
				f(x + x + 1 - me.first, 1);
				f(me.first, 0);
			}
			else {
				f(x + x + 1 - me.first, 0);
			}
		}
		if(me != make_pair(0, 0)) {
			f(0, 0);
		}
	}
	printf("%d\n", (int) answer.size() - 1);
	for(pair<int,int> p : answer) {
		printf("%d %d\n", p.first, p.second);
	}
}

// U1, U0, D0, U1, D1, D0, U0, D1

```