Buggy python submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())

def max_vote(places):
  max_index = places.index(max(places))
  places[max_index] = -1
  return max_index + 1, places

while 1:
  places = []
  for m in  range(M):
    places.append(0)
  for n in N:
    votes = map(int, raw_input().split())
    count = 0
    for vote in votes:
      if vote == 1:
        places[count] += 1
      else:
        pass
      count += 1 
  for m in range(M):
    answer, places = max_vote(places)
    print answer,

Fixed submission:
while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print

Buggy python submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())

def max_vote(places):
  max_index = places.index(max(places))
  places[max_index] = -1
  return max_index + 1, places

while 1:
  places = []
  for m in  range(M):
    places.append(0)
  for n in N:
    votes = map(int, raw_input().split())
    count = 0
    for vote in votes:
      if vote == 1:
        places[count] += 1
      else:
        pass
      count += 1 
  for m in range(M):
    answer, places = max_vote(places)
    print answer,

Fixed submission:
while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print

Buggy python submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())

def max_vote(places):
  max_index = places.index(max(places))
  places[max_index] = -1
  return max_index + 1, places

while 1:
  places = []
  for m in  range(M):
    places.append(0)
  for n in N:
    votes = map(int, raw_input().split())
    count = 0
    for vote in votes:
      if vote == 1:
        places[count] += 1
      else:
        pass
      count += 1 
  for m in range(M):
    answer, places = max_vote(places)
    print answer,

Fixed submission:
while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print

Buggy python submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())

def max_vote(places):
  max_index = places.index(max(places))
  places[max_index] = -1
  return max_index + 1, places

while 1:
  places = []
  for m in  range(M):
    places.append(0)
  for n in N:
    votes = map(int, raw_input().split())
    count = 0
    for vote in votes:
      if vote == 1:
        places[count] += 1
      else:
        pass
      count += 1 
  for m in range(M):
    answer, places = max_vote(places)
    print answer,

Fixed submission:
while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print

Buggy python submission (verdict: Runtime Error):
def max_vote(places):
  max_index = places.index(max(places))
  places[max_index] = -1
  return max_index + 1, places

while 1:
  N, M = map(int, raw_input().split())
  if N ==0, M ==0: break
  places = []
  for m in  range(M):
    places.append(0)
  for n in N:
    votes = map(int, raw_input().split())
    count = 0
    for vote in votes:
      if vote == 1:
        places[count] += 1
      else:
        pass
      count += 1 
  for m in range(M):
    answer, places = max_vote(places)
    print answer,

Fixed submission:
while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print

Buggy python submission (verdict: Runtime Error):
def max_vote(places):
  max_index = places.index(max(places))
  places[max_index] = -1
  return max_index + 1, places

while 1:
  N, M = map(int, raw_input().split())
  if N ==0 and M ==0: break
  places = []
  for m in  range(M):
    places.append(0)
  for n in N:
    votes = map(int, raw_input().split())
    count = 0
    for vote in votes:
      if vote == 1:
        places[count] += 1
      else:
        pass
      count += 1 
  for m in range(M):
    answer, places = max_vote(places)
    print answer,

Fixed submission:
while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print

Buggy python submission (verdict: Runtime Error):
def max_vote(places):
  max_index = places.index(max(places))
  places[max_index] = -1
  return max_index + 1, places

while 1:
  N, M = map(int, raw_input().split())
  if N ==0 and M ==0: break
  places = []
  for m in  range(M):
    places.append(0)
  for n in N:
    votes = map(int, raw_input().split())
    count = 0
    for vote in votes:
      if vote == 1:
        places[count] += 1
      else:
        pass
      count += 1 
  for m in range(M):
    answer, places = max_vote(places)
    print answer,
  print

Fixed submission:
while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print

Buggy python submission (verdict: Runtime Error):
while 1:
  n, m = map(int, raw_input())
  if n == 0 and m == 0:
    break
  places = dict(zip(range(m), [0]*m))
  for i in range(n):
    vote = map(int,raw_input().split()) 
    for j in range(m):
      places[j] += vote[j]
  for k, v sorted(a.items,key=lambda x:x[1],reverse=1):
    print k+1
  print

Fixed submission:
while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print

Buggy python submission (verdict: Runtime Error):
while 1:
  n, m = map(int, raw_input())
  if n == 0 and m == 0:
    break
  places = dict(zip(range(m), [0]*m))
  for i in range(n):
    vote = map(int,raw_input().split()) 
    for j in range(m):
      places[j] += vote[j]
  for k, v sorted(a.items,key=lambda x:x[1],reverse=1):
    print k+1
  print

Fixed submission:
while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print

Buggy python submission (verdict: Runtime Error):
while 1:
  n, m = map(int, raw_input().split())
  if n == 0 and m == 0:
    break
  places = dict(zip(range(m), [0]*m))
  for i in range(n):
    vote = map(int,raw_input().split()) 
    for j in range(m):
      places[j] += vote[j]
  for k, v sorted(a.items,key=lambda x:x[1],reverse=1):
    print k+1
  print

Fixed submission:
while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print

Buggy python submission (verdict: Runtime Error):
while 1:
  n, m = map(int, raw_input().split())
  if n == 0 and m == 0:
    break
  places = dict(zip(range(m), [0]*m))
  for i in range(n):
    vote = map(int,raw_input().split()) 
    for j in range(m):
      places[j] += vote[j]
  for k, v sorted(places.items,key=lambda x:x[1],reverse=1):
    print k+1
  print

Fixed submission:
while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print