with ada.integer_text_io; use ada.integer_text_io; 
with ada.text_io; use ada.text_io; 
 
procedure tryexceps is

    procedure get_one_NO_handler(i: out Natural) is
    begin
        get(i);
    end get_one_NO_handler;    

    procedure get_one_has_handler(i: out Natural) is
    begin
        get(i);
    exception
        when DATA_ERROR => 
            put_line("DATA ERROR occurred");
            i := 0; 
    end get_one_has_handler;    

    procedure get_two_nats(i, j: out Natural) is
    begin
        get_one_NO_handler(i);
        get_one_has_handler(j);
    exception
        when END_ERROR => 
            put_line("END ERROR occurred");
            i := 1; j := 1;
    end get_two_nats;    


    m, n: Natural;

begin -- main
    get_two_nats(m, n);
    put(m); put(n);
exception
    when CONSTRAINT_ERROR => 
        put_line("CONSTRAINT ERROR occurred");
end tryexceps;