http://noi.openjudge.cn/ch0109/10/
"""
1.9 编程基础之顺序查找 10 找最大数序列(5分)
http://noi.openjudge.cn/ch0109/10/
使用python创建一个n*空的二维数组
https://blog.csdn.net/weixin_40378404/article/details/93214422
//k是第二维数组的个数
arr=[[] for i in range(k)]
python创建二维列表的两种方法
https://blog.csdn.net/liangjiubujiu/article/details/82153095
Python中List二维数组
https://blog.csdn.net/mimi9919/article/details/51458342
Python 创建二维列表list
https://blog.csdn.net/cxj540947672/article/details/85257589
python list 创建二维数组的坑
https://blog.csdn.net/lccrun/article/details/98205870
python list二维数组列数_Python创建二维数组的正确姿势
https://blog.csdn.net/weixin_39658759/article/details/113582574
https://blog.csdn.net/figo8875/article/details/90300989
https://blog.csdn.net/yockie/article/details/46127829
在多维数组中遍历其中的单个元素 --python
https://blog.csdn.net/weixin_43236007/article/details/104476943
三、Python语法基础---序列、列表、元组
https://blog.csdn.net/qq_37958578/article/details/104809927
https://www.jb51.net/article/142196.htm
"""
n=int(input())
num_list = [ [] for i in range(n)]
#print(num_list)
k=0
max=0
while k<n:
a=list(map(int,input().split(',')))
lena=len(a)
#print(lena)
i=0
while i<lena:
num_list[k].append(a[i])
if a[i]>max:
max=a[i]
i+=1
k+=1
print(max)
#print(num_list)
ans=[]
k=0
while k<n:
for num in num_list[k]:
if num==max:
#print(k+1,end=',')
ans.append(k+1)
k+=1
#print(ans)
lenx=len(ans)
j=0
while j<lenx-2:
print(ans[j],end=',')
j+=1
print(ans[j])