var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var n=Arr.shift()-0;
var obj={};
for(var i=0;i<n;i++){
   obj[Arr.shift()]=true;
}
var n=Arr.shift()-0;
var flag=false;
for(var i=0;i<n;i++){
   var v=Arr.shift();
   if(obj.hasOwnProperty(v)){
      flag=!flag;
      if(flag){console.log("Opened by "+v);}
      else {console.log("Closed by "+v);}
   }else{
      console.log("Unknown "+v);
   }
}