#include<bits/stdc++.h> using namespace std; #define s(f,t,n) for(int n=f;n<=t;n++) int n,a[15]; int main(){ scanf("%d",&n); while(n){ for(int i=1;i<=n;i++)scanf("%d",&a[i]); s(1,n-5,i1)s(i1+1,n-4,i2)s(i2+1,n-3,i3)s(i3+1,n-2,i4)s(i4+1,n-1,i5)s(i5+1,n,i6){ printf("%d %d %d %d %d %d\n",a[i1],a[i2],a[i3],a[i4],a[i5],a[i6]); }printf("\n"); scanf("%d",&n); } return 0; }