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
        }
    }
}

Python: k=[input() for _ in range(int(input()))]
a=1
for _ in range(int(input())):
    b=input()
    if b in k:print(['Closed','Opened'][a>0]+' by '+b);a=~a
    else:print('Unknown '+b)

Python: s={input() for _ in range(int(input()))}
k=False
t=[input() for _ in range(int(input()))]
for i in t:
  if i in s:
    k=not k
    if k:
      print("Opened by",i)
    else:
      print("Closed by",i)
  else:
    print("Unknown",i)

Python: #!/usr/bin/env python
# -*- coding: utf-8 -*-

N = int(input())
U = [input() for i in range(0,N)]
M = int(input())
door = False
for i in range(M):
    T = input()
    if T in U:
        if door == True:
            print("Closed by " + T)
            door = False
        else:
            print("Opened by " + T)
            door = True
    else:
        print("Unknown " + T)

Python: #!/usr/bin/env python3
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    n = int(input())
    ids = [input() for i in range(n)]
    m = int(input())
    locked = True
    for j in range(m):
        t = input()
        if t in ids:
            if locked:
                print("Opened by {}".format(t))
                locked = False
            else:
                print("Closed by {}".format(t))
                locked = True
        else:
            print("Unknown {}".format(t))

Python: n = int(input())
ids = [input() for _ in range(n)]
m = int(input())
cnt = 0
for _ in range(m):
  t = input()
  if t in ids:
    cnt += 1
    move = ["Closed by", "Opened by"]
    print(move[cnt % 2], t)
  else:
    print("Unknown", t)

Python: l = [input() for _ in range(int(input()))]
f,r = True,''
for _ in range(int(input())):
    s = input()
    if s in l:
        if f: r = 'Opened by '+s
        else: r = 'Closed by '+s
        f = not(f)
    else: r = 'Unknown '+s
    print(r)

Python: n = int(input())
xs = []
for i in range(n): xs.append(input())
m = int(input())
flag = 1
for i in range(m):
    s = input()
    if s in xs:
        print("Opened" if flag == 1 else "Closed", "by", s)
        flag ^= 1
    else:
        print("Unknown", s)

Python: # -*- coding: utf-8 -*-
"""
Created on Mon Jun 13 17:16:33 2016

"""

U = []
n = int(input())
for _ in range(n):
    U.append(input())

D = True
U = set(U)
    
m = int(input())
for _ in range(m):
    t = input()
    if t in U:
        print({True:"Opened by ", False:"Closed by "}[D]+t)
        D = not D
    else:
        print("Unknown " + t)

Python: k=[input() for _ in range(int(input()))]
a=1
for _ in range(int(input())):
    b=input()
    if b in k:print(('Opend' if a>0 else 'Closed')+' by '+b);a=~a
    else:print('Unknown '+b)

Python: U=[]
T=[]
N=int(input())
for i in range(N):
  U.append(input())
M=int(input())
for i in range(M):
  T.append(input())
count=0
for i in range(len(T)):
  for j in range(len(U)):
    if T[i]==U[j]:
      if count==0:
        print("Opened by",T[i])
        count=1
        break
      if count==1:
        print("Closed by",T[i])
        count=0
        break
    if j==int(len(U))-1:
      print("Unknown",T[i])

Python: # coding: utf-8
data={}
for i in range(int(input())):
    data[input()]=False
f=False
for i in range(int(input())):
    key=input()
    if key in data:
        if f:
            print('Closed by',key)
            f=False
        else:
            print('Opened by',key)
            f=True
    else:
        print('Unknown',key)

Python: flag = 0
N = int(input())
Us = [input() for _ in range(N)]
M = int(input())
for _ in range(M):
    T = input()
    if T in Us: flag ^= 1
    else:
        print("Unknown {}".format(T))
        continue
    print("{} by {}".format(["Closed", "Opened"][flag], T))

Python: if __name__ == '__main__':
    n = int(input())
    reg = []
    for _ in range(n):
        reg.append(input())
    m = int(input())
    state = 0

    for _ in range(m):
        p = input()
        if p in reg and not state:
            print("Opened by %s" % (p))
            state = 1
        elif p in reg and state:
            print("Closed by %s" % (p))
            state = 0
        else:print("Unkown %s" % (p))

Python: n = int(input())
registerd = [input() for _ in range(n)]

door_open = False

m = int(input())
for _ in range(m):
    ic = input()
    if ic in registerd:
        if door_open:
            print("Closed by {0}".format(ic))
            door_open = False
        else:
            print("Opened by {0}".format(ic))
            door_open = True
    else:
        print("Unknown {0}".format(ic))

Python: if __name__ == '__main__':
    n = int(input())
    reg = []
    for _ in range(n):
        reg.append(input())
    m = int(input())
    state = 0

    for _ in range(m):
        p = input()
        if p in reg and not state:
            print("Opened by %s" % (p))
            state = 1
        elif p in reg and state:
            print("Closed by %s" % (p))
            state = 0
        else:print("Unknown %s" % (p))

Python: now=False
N=int(input())
for k in range(N):
    lst=lst.append(input())
M=int(input())
for t in range(M):
    ID=input()
    if ID in lst:
        now=not(now)
        if now:
            print("Opened by",ID)
        else:
            print("Closed by",ID)
    else:
        print("Unknown",ID)

Python: N = int(input())
U = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]
# open: True, close: False
f = False
for i in T:
    if i in U:
        if f:
            print("Closed by {}".format(i))
        else:
            print("Opened by {}".format(i))
        f = not f
    else:
        print("Unknown {}".format(i))

Python: n = int(input())
l1 = [input() for i in range(n)]

m = int(input())
c = 0
l = ["Opened","Closed"]
for i in range(m):
  s = input()
  if s in l1:
    print(l[c%2]+" by "+ s)
    c += 1
  else:
    print("Unknown "+ s)

Python: def main():
    N = int(input())
    IDs = []
    for _ in range(N):
        IDs.append(input())
    locked = True
    M = int(input())
    for _ in range(M):
        t = input()
        if t in IDs:
            if locked:
                print('Opened by', t)
                locked = False
            else:
                print('Closed by', t)
                locked = True
        else:
            print('Unknown', t)

if __name__ == '__main__':
    main()

Python: n = int(input())
user = [input() for i in range(n)]

m = int(input())
locked = True
for i in range(m):
    t = input()
    if t in user:
        if locked:
            locked = False
            print("Opened by", t)
        else:
            locked = True
            print("Closed by", t)
    else:
        print("Unknown", t)

Python: a = int(input())
b = []
clo = True
for i in range(a):
    b.append(input())

c = int(input())
for i in range(c):
    d = input()
    for j in range(a):
        if d == b[j]:
            know = True
            break
        else:
            know = False
    if know:
        if clo:
            clo = False
            print("Opened by " + d)
        else:
            clo = True
            print("Closed by " + d)
    else:
        print("Unknown " + d)
print("\n")