Go: package main

import "fmt"

func main() {
    var n, m int
    fmt.Scan(&n)

    u := make([]string, 300)

    for i := 0; i < n; i++ {
        fmt.Scan(&u[i])
    }

    fmt.Scan(&m)

    is_lock := true
    for i := 0; i < m; i++ {
        var t string
        fmt.Scan(&t)

        is_include := false
        for j := 0; j < n; j++ {
            if t == u[j] {
                is_include = true
                break
            }
        }
        if is_include == false {
            fmt.Printf("Unknown %s\n", t)
        } else if (is_lock) {
            fmt.Printf("Opened by %s\n", t)
            is_lock = false
        } else {
            fmt.Printf("Closed by %s\n", t)
            is_lock = true
        }
    }
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;
  while(cin >> n){
    set<string> st;
    string s;
    rep(i,n){
      cin >> s;
      st.insert(s);
    }
    bool f = false;
    cin >> m;
    rep(i,m){
      cin >> s;
      if(st.find(s) == st.end()){
        cout << "Unknown " + s<< endl;
      }
      else{
        if(f){
          cout << "Closed by " + s<<endl;
        }
        else{
          cout << "Opened by " + s << endl;
        }
        f = !f;
      }
    }
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <cstdio>

using namespace std;

int main() {
	int n; cin >> n;
	map<string, int> uid;
	for (int i = 0; i < n; ++i) {
		string str; cin >> str;
		uid[str] = i;
	}
	int m; cin >> m;
	bool f = false;
	for (int i = 0; i < m; ++i) {
		string str; cin >> str;
		if (uid.find(str) != uid.end()) {
			if (!f) printf("Opened by %s\n", str.c_str());
			else printf("Closed by %s\n", str.c_str());
			f = !f;
		}
		else {
			printf("Unknown %s\n", str.c_str());
		}
	}
}

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

const int INF = 1000000007;
const int MOD = 1000000007;

typedef long long ll;
typedef pair<int, int> pr;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    string u[256];
    string t;
    while(cin >> n){
        for(int i = 0; i < n; i++){
            cin >> u[i];
        }
        cin >> m;
        int st = 0;
        for(int i = 0; i < m; i++){
            cin >> t;
            int j = 0;
            for(j = 0; j < n; j++){
                if(t == u[j]) break;
            }
            if(j == n){
                cout << "Unknown ";
            }else{
                st = 1 - st;
                cout << ((st == 1) ? "Opened" : "Closed") << " by ";
            }
            cout << t << endl;
        }
    }
    return 0;
}

C++: 
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>

using namespace std;


string u[257];
string t[257];

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

	for(int i = 0;i < n;i++)
	{
		cin >> u[i];
	}

	int m;

	cin >> m;

	for(int i = 0;i < m;i++)
	{
		cin >> t[i];
	}

	int p = 1;

	for(int i = 0;i < m;i++)
	{
		bool flag = false;
		for(int j = 0;j < n;j++)
		{
			if(u[j] == t[i])flag = true;
		}

		if(flag)
		{
			if(p)
			{
				cout << "Opened by ";
			}else
			{
				cout << "Closed by ";
			}
			p = 1 - p;
		}else
		{
			cout << "Unknown ";
		}

		cout << t[i] << endl;
	}


	return 0;
}

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

int main(){
  int n,m;
  string u,t;
  set<string> id;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> u;
    id.insert(u);
  }

  cin >> m;
  bool isOpen = false;
  for(int i=0;i<m;i++){
    cin >> t;
    if(id.count(t)){
      if(isOpen)cout << "Closed by " << t << endl;
      else cout << "Opened by " << t << endl;
      isOpen = !isOpen;
    }else cout << "Unknown " << t << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define between(a,x,b) ((a)<=(x)&&(x)<=(b))
using namespace std;

int main(){
  bool f = true;
  int n, m;
  string tmp;
  char in[16];
  scanf("%d", &n);
  vector<string>str(n);
  rep(i, n){
    scanf("%s", in);
    str.push_back(string(in));
  }
  scanf("%d", &m);
  rep(i, m){
    scanf("%s", in);
    if(find(str.begin(), str.end(), in) != str.end()){
      if(f) printf("Opened by %s\n", in), f = 0;
      else printf("Closed by %s\n", in), f = 1;
    }else printf("Unknown %s\n", in);
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7+1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n,m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/


int main()
{
	bool flag = 0;
	cin >> n;
	vs vans(n);
	REP(i, n) cin >> vans[i];
	cin >> m;
	vs  v(m);
	REP(i, m) cin >> v[i];
	REP(i, m)
	{
		REP(j, n)
		{
			if (v[i] == vans[j]) {
				if (flag == 0) {
					cout << "Opened by " << v[i] << endl;
					flag = 1;
				} else if (flag == 1) {
					cout << "Closed by " << v[i] << endl;
					flag = 0;
				}
				break;
			}
			if (j == n - 1) {
				cout << "Unknown " << v[i] << endl;
			}
		}
	}
}