#include <iostream>
#include <algorithm>
using namespace std;
int main() {
long long n;
cin>>n;
long long x[n];
for(int i=0;i<n;i++)
{
cin>>x[i];
}
int ind=0;
for(int i=0;i<n-1;i++)
{
if(x[i]!=0)
{
ind=find(x+ind,x+n,x[i]*4/3)-x;
cout<<x[i]<<'\n';
x[ind]=0;
}
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7Cglsb25nIGxvbmcgbjsKCWNpbj4+bjsKCWxvbmcgbG9uZyB4W25dOwoJZm9yKGludCBpPTA7aTxuO2krKykKCXsKCQljaW4+PnhbaV07Cgl9CglpbnQgaW5kPTA7Cglmb3IoaW50IGk9MDtpPG4tMTtpKyspCgl7CgkJaWYoeFtpXSE9MCkKCQl7CgkJCWluZD1maW5kKHgraW5kLHgrbix4W2ldKjQvMykteDsKCQkJCWNvdXQ8PHhbaV08PCdcbic7CgkJCQl4W2luZF09MDsKCQl9Cgl9CglyZXR1cm4gMDsKfQ==