#include <iostream>
#include <istream>
#include <sstream>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cmath>
#include <cctype>
#include <string>
#include <cstdio>
#include <iomanip>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <iterator>
using namespace std;
int g[52][52];
int c[52];
void Init() {
cin.ignore();
memset(g, 0, sizeof(g));
memset(c, 0, sizeof(c));
}
int GetID(char a, char b) {
return (a - 'A') * 2 + (b == '+' ? 1 : 0);
}
void Connect(char a, char b, char c, char d) {
if (a == '0' || c == '0') return;
//ID(a,b) = A- 那么 ua = A+,A+ - > A- 标号ua 可以到达 ub
int ua = GetID(a, b) ^ 1, uc = GetID(c, d);
g[ua][uc] = 1;
}
void Input() {
string temp;
cin >> temp;
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++) {
if (i != j) {
Connect(temp[i * 2], temp[i * 2 + 1], temp[j * 2], temp[j * 2 + 1]);
}
}
}
bool dfs(int u) {
c[u] = -1;
for (int i = 0; i < 52; ++i) {
if (g[u][i]) {
if (c[i] < 0) return true;
else if (!c[i] && dfs(i)) return true;
}
}
c[u] = 1;
return false;
}
bool HasCycle() {
for (int i = 0; i < 52; ++i) {
if (!c[i]) {
if (dfs(i)) return true;
}
}
return false;
}
int main()
{
int n;
while (cin >> n) {
Init();
for (int i = 0; i < n; ++i) {
Input();
}
if (HasCycle()) cout << "unbounded" << endl;
else cout << "bounded" << endl;
}
return 0;
}
12-25
07-28
07-28