package com.codegym.task.task05.task0532;

import java.io.*;

/*
Task about algorithms

*/

public class Solution {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int maximum = 0;

        while (true) {
            int n = Integer.parseInt(reader.readLine());
            if (n > maximum) {
                maximum = n;
            }else if (n <= 0){
                break;
            }


            //write your code here

            System.out.println(maximum);
        }
    }
}