#include<iostream>
using namespace std;
int main()
{
    int n;cin >> n;
    int m = n;
    double a[n];double ans;
    for(int i = 0;i < n;i++)cin >> a[i];
    float min1 = 99999,min2 = 99999,index1,index2;
    while(m > 1)
    {
        min1 = 99999;min2 = 99999;
        for(int i = 0;i < n;i++)
        {
            if(min1 > a[i])
            {
                min1 = a[i];
                index1 = i;
            }
        }
        int fixer = a[index1];
        a[index1] = 999999;
        for(int i = 0;i < n;i++)
        {
            if(min2 > a[i])
            {
                min2 = a[i];
                index2 = i;
            }
        }
        cout << min1 << " " << min2 << endl;
        a[index1] = fixer;
        ans = min1 + min2;
        ans = ans/ 2;
        if(index1 < index2){
                a[index1] = ans;
                a[index2] = 99999;
        }
        else {
                a[index2] = ans;
                a[index1] = 99999;
        }
        for(int i = 0;i < n;i++)cout << a[i] << " ";
        cout << endl;
        m--;
    }
    cout << ans;
    return 0;
}
