import sys input = sys.stdin.readline N,K=map(int,input().split()) S=[input().split() for i in range(N)] DP=[1<<63]*(K+2+100) DP[0]=0 T="J"*K+"O"*K+"I"*K for i in range(len(T)): NEXT=T[i:i+80] for j in range(N): ind=0 M=int(S[j][1]) for s in S[j][0]: if ind