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;
using ll=long long;

#define itn long long
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)(n);i>=0;--i)
#define debug(x) cout << #x << "=" << (x) << endl;
const ll MOD=1e9+7;

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end

void solve(){
  int N;
  cin>>N;
  map<string,int> m;
  rep(i,N){
    string s;
    cin>>s;
    m[s]=1;
  }
  int M;
  cin>>M;
  int st=1;
  string r[]={"Unknown ","Opened by ","Closed by "};
  rep(i,M){
    string s;
    cin>>s;
    if(m[s]){cout<<r[st]<<s<<endl;st^=3;}
    else cout<<r[0]<<s<<endl;
  }
}
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}

C++: #include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#include<utility>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define fori(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
/*
(char)'1' - (int)48 = (int)1;


*/


int main()
{
	string a[300];
	int n;
	int m; cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	cin >> m;
	bool now = true;
	for (int i = 0; i < m; i++)
	{
		string x;
		cin >> x;
		bool ok=false;
		for (int l = 0; l < n; l++)
		{
			if (a[l] == x)
			{
				ok = true; break;
			}
		}
		if (ok)
		{
			if (now)
			{
				cout << "Opened by " << x << endl;
				now = false;
			}
			else
			{
				cout << "Closed by " << x << endl;
				now = true;
			}
		}
		else
		{
			cout << "Unknown " << x << endl;
		}
	}
}

C++: #include <iostream>
#include <unordered_set>

#define REP(i, n) for(int (i) = 0; (i) < (n); i++)

using namespace std;

inline int nextInt()       { int d;    cin >> d; return d; }
inline string nextString() { string s; cin >> s; return s; }

int main() {
  int N = nextInt();
  
  unordered_set<string> IDs;
  
  REP(i, N) {
    string str = nextString();
    IDs.insert(str);
  }
  
  int M = nextInt();
  
  bool isOpen = false;
  REP(i, M) {
    string str = nextString();
    if (IDs.find(str) != IDs.end()) {
      // if ID found
      if (isOpen) {
        cout << "Closed by " << str << endl;
      } else {
        cout << "Opened by " << str << endl;
      }
      isOpen = !isOpen;
    } else {
      // Not found
      cout << "Unknown " << str << endl;
    }
  }
  
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <set>
using namespace std;

int n,m;
int main(void){
	set<string> id;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		string str;
		cin >> str;
		id.insert(str);
	}
	scanf("%d",&m);
	bool flag=false;
	for(int i=0;i<m;i++){
		string str;
		cin >> str;
		if(id.find(str)!=id.end()){
			if(!flag)cout << "Opened";
			else cout << "Closed";
			cout << " by " << str << endl;
			flag=!flag;
		}else{
			cout << "Unknown " << str << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <set>
#define llint long long

using namespace std;

llint n, m;
set<string> S;

int main(void)
{
	cin >> n;
	string s;
	for(int i = 1; i <= n; i++){
		cin >> s;
		S.insert(s);
	}
	
	cin >> m;
	
	bool flag = true;
	for(int i = 1; i <= m; i++){
		cin >> s;
		if(S.count(s)){
			if(flag) cout << "Opened by " << s << endl;
			else cout << "Closed by " << s << endl;
			flag = !flag;
		}
		else cout << "Unknown " << s << endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
using namespace std;

int main(){
    int N;
    cin>> N;
    vector<string>U(N);
    for(auto &a : U){
        cin >>a;
    }
    int M;
    cin >>M;
    int flag=0,auth;
    for(int i=0;i<M;i++){
        string s;
        cin >>s;
        auth=0;
        for(int j=0;j<N;j++){
            if(U[j]==s){
                if(flag==0){
                    cout<<"Opened by "<<s<<endl;
                    flag=1;
                }
                else{
                    cout<<"Closed by "<<s<<endl;
                    flag=0;
                }
                auth=1;
                break;
            }
            if(auth)break;
        }
        if(auth==0)cout<<"Unknown "<<s<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<iomanip>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{"; for(auto nth : list){ cout << nth << " ";}cout << "}" << endl;

using namespace std;

string table[]={"qwertasdfgzxcvb","yuiophjklnm"};


int main(){

		int n;
		vector<string> list;
		cin >> n;
		
		for(int i=0;i<n;i++){
			string str;
			cin >> str;
			list.push_back(str);	
		}

		cin >> n;
		
		bool flag=false,s_flag=false;

		for(int i=0;i<n;i++){
			string str;
			cin >> str;
			for(int k=0;k<list.size();k++){
				if(list[k]==str){
					if(flag==false){
						cout << "Opened by " << str << endl; 
						flag = true;
					}
					else if(flag==true){
						cout << "Closed by " << str << endl;
						flag = false;
					}
					s_flag=true;
				}
			}
			if(!s_flag){
				cout << "Unknown " << str << endl;
			}
			s_flag=false;
		}

}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
#include<set>

using namespace std;

int main(void){

  int n;
  cin >> n;
  set<string>S;

  for(int i=0;i<n;i++){
    string in;
    cin >> in;
    S.insert(in);
  }

  bool now=false;
  cin >> n;
  for(int i=0;i<n;i++){
    string in;
    cin >> in;
    if(!S.count(in))cout << "Unknown " << in << endl;
    else if(!now)cout << "Opened by " << in << endl,now=!now;
    else if(now)cout << "Closed by " << in << endl,now=!now;
  }

  return 0;
}

C++: #include<bits/stdc++.h>

int main(){
　int N,M;
  int cnt1 = 0;
  int cnt2 = 0;
  string U[256];
  string T[256];
  cin>>N;
  for(int i=0;i<N;i++) cin>>U[i];
  cin>>M;
  for(int j=0;j<M;j++) cin>>T[j];
  for(int j=0;j<M;j++){
  for(int i=0;i<N;i++){
 if(T[j] == U[i]) cnt1++;
 else cnt2++;
 }
if(cnt1 % 2 == 1 && cnt2 != N) cout<<"Opened by"<<" "<<T[j]<<endl;
if(cnt2 % 2 == 0 && cnt2 != N) cout<<"Closed by"<<" "<<T[j]<<endl;
if(cnt2 == N) cout<<"Unknown"<<" "<<T[j]<<endl;
cnt2 = 0;
}
 return 0;
}