import sys

def printlist(v):
  for a in v:
    sys.stdout.write(str(a))
    sys.stdout.write(',')

def printbfile(v):
  for i in range(len(v)):
    print i + 1,
    print v[i]

def calcinfo(n):
  nbbits = (n-1)*n / 2
  m = 2**nbbits-1
  return {'size': n, 'nbbits': nbbits, 'max': m, 'closed': {}}

def bitnum(info,i,j):
  if i == j: raise ArithmeticError()
  if i < 0 or j < 0 or i >= info['size'] or j >= info['size'] : raise ArithmeticError()
  if j > i: i, j = j, i
  return info['nbbits'] - 1 - (j*info['size'] - (j*(j+1))/2 + (i - j - 1))

def bit(info,v,i,j):
  if i == j: return 1
  return (v >> bitnum(info,i,j)) & 1

def setbit(info,v,i,j):
  if i == j: return v
  return v | (1 << bitnum(info,i,j))

def printmat(info,v):
  for j in xrange(info['size']):
    for i in xrange(info['size']):
      print bit(info,v,i,j),
    print ''

def addall(info, res, v):
  done = 0;
  for i in xrange(1, info['size']):
    if done & (1 << i):
      continue
    m = v
    for j in xrange(1, info['size']):
      if (bit(info,m,i,j)):
        m = setbit(info,m,j,0)
        done = done | (1 << j)
    res.append(m)

def matn(info):
  n = info['size']
  if n == 2:
    return [0,1]
  pv = matn(calcinfo(n - 1))
  res = list(pv)
  for v in pv:
    addall(info, res, v)
  return sorted(res)

printbfile(matn(calcinfo(10)))