from subprocess import*

call(('python3','-c',"""

from numpy import*

a=loadtxt(open(0),'i',skiprows=1,ndmin=2)

n=x=len(a)

while a.any():

  t=bincount(a[:,0])

  x,a=min(x,max(t)),reshape(a[a!=argmax(t)],(n,-1))

print(x)

"""))
from numpy import*

n=x=len(a:=loadtxt(open(0),"i",skiprows=1,ndmin=2))

while any(a):x=min(x,max(t:=bincount(a[:,0])));a=reshape(a[a!=argmax(t)],(n,-1))

print(x)
from subprocess import *

call(
    (
        "python3",
        "-c",
        """
from numpy import*
a=loadtxt(open(0),'i',skiprows=1,ndmin=2)
n=x=len(a)
while a.any():
  t=bincount(a[:,0])
  x,a=min(x,max(t)),reshape(a[a!=argmax(t)],(n,-1))
print(x)
""",
    )
)

from numpy import *

n = x = len(a := loadtxt(open(0), "i", skiprows=1, ndmin=2))
while any(a):
    x = min(x, max(t := bincount(a[:, 0])))
    a = reshape(a[a != argmax(t)], (n, -1))
print(x)

-from subprocess import * +from numpy import * -call( -    ( -        "python3", -        "-c", -        """ -from numpy import* -a=loadtxt(open(0),'i',skiprows=1,ndmin=2) -n=x=len(a) -while a.any(): -  t=bincount(a[:,0]) -  x,a=min(x,max(t)),reshape(a[a!=argmax(t)],(n,-1)) +n = x = len(a := loadtxt(open(0), "i", skiprows=1, ndmin=2)) +while any(a): +    x = min(x, max(t := bincount(a[:, 0]))) +    a = reshape(a[a != argmax(t)], (n, -1)) -""", -    ) -)