Загрузка данных


n = int(input())

max_speed = 0
has_violators = False

for _ in range(n):
    m = int(input())
    # Считываем все скорости текущей машины в список
    speeds = [int(input()) for _ in range(m)]
    
    # Проверяем, нарушила ли эта конкретная машина
    car_violates = False
    for speed in speeds:
        if speed > 60:
            car_violates = True
            has_violators = True
            
    # Если машина НИ РАЗУ не нарушила, обновляем максимум
    if not car_violates:
        for speed in speeds:
            if speed > max_speed:
                max_speed = speed

print(max_speed)
print("ДА" if has_violators else "НЕТ")