#include<iostream>
#include<queue>
using namespace std;
int main(){
    priority_queue<int> leftheap;//maxheap
    priority_queue<int, vector<int>, greater<int> > rightheap;//meanheap
    //priority_queue<int, greater<int> > rightheap;
    int d;
    cin>>d;
    leftheap.push(d);
    float med = d;
    cout<<"median"<<med<<" ";
    //input all data
    while(d != -1){
        //logic for median
        if(leftheap.size()>rightheap.size()){
            if(d<med){
                rightheap.push(leftheap.top());
                leftheap.pop();
                leftheap.push(d);
            }
            else{
                rightheap.push(d);
            }
            med = (leftheap.top()+rightheap.top())/2.0;
        }
        else if(leftheap.size()==rightheap.size()){
            if(d<med){
                leftheap.push(d);
                med = leftheap.top();
                }
            else{
                rightheap.push(d);
                med = rightheap.top();
            }
        }
        else if(rightheap.size()>leftheap.size()){
            if(d>med){
                leftheap.push(rightheap.top());
                rightheap.pop();
                rightheap.push(d);
            }
            else{
                leftheap.push(d);
            }
            med = (leftheap.top()+rightheap.top())/2.0;
        }
        cout<<"median"<<med<<endl;
        cin>>d;
    }
return 0;}
