ior = io.read local n = ior("*n", "*l") local sekilist = {} for i = 1, 20 do sekilist[i] = {} end for i = 1, n do local q = ior("*n") if(q == 0) then local seki, c, str = ior("*n", "*n", "*l") --print(seki, c, str) local netas = {} for neta in str:gmatch("%w+") do if(netas[neta] == nil) then netas[neta] = 1 else netas[neta] = netas[neta] + 1 end end sekilist[seki] = netas elseif(q == 1) then local _, neta = ior(1, "*l") local found = false for j = 1, 20 do if(sekilist[j][neta] ~= nil) then print(j) if(sekilist[j][neta] == 1) then sekilist[j][neta] = nil else sekilist[j][neta] = sekilist[j][neta] - 1 end found = true break end end if(not found) then print(-1) end else local seki = ior("*n", "*l") --print(seki) sekilist[seki] = {} end end