
#include <stdlib.h>
#include <stdio.h>

#define u(x,y) (((x) >> (y)) & 1) | (((x) >> (y+1)) & 1)
#define i(x,y) u(x,y) | u(x,y+2)
#define j(x,y) i(x,y) | i(x,y+4)
#define k(x,y) j(x,y) | j(x,y+8)
#define Z(x) (k(x,0) | k(x,16))

#define Y(x) Z((n) x)

#define a void
#define n int
#define T typedef
#define S struct L
#define C char
#define F(x) (w ** l, n q, n c, C *D[], x, h(m) (a))
#define E(x) (w * q, w ** c, x, h(m) (a))
#define G(x) (w *l, n q, x)
#define H(x,y) x = malloc(sizeof(w)); (*m[Y(x)]) (); (x)->D = y
#define I(x,y,o) (*d[Z(c - 1)]) (x, y, c - 1, o, (a *) d, m)
#define J(x,y) (*f[Y(x)]) (x, y, (a *) f, m);
#define b(x,y) (*B[Y(x)]) (x, y, (a *) B)
#define h(x) a (*x [2])
#define g(x,y,o,q) h(x) y = { o, q }
#define e printf

T S { C *D; S *N; } w; T h(z) F(a *); T h(p) E(a *); T h(A) G(a *);

a M(a) {} a Q(a) { e("\b\b"); } a K(a) { e("Out of memory.\n"); exit(1); }

a R F(z d) { *l = NULL; } a W F(z d) { H(*l, D[q]); I(&((*l)->N), q + 1, D); }

a O G(A B) { g(s, (a), M, Q); (*s[q]) (); } a P G(A B) { e("%s, ", l->D); b(l->N, 1); }

a X E(p f) {} a U E(p f) { w *l; H(l, q->D); l->N = *c; *c = l; J(q->N, c); }

n main(n c, C *V[])
{
    w *l, *r = NULL;
    g(m, (a), K, M); g(d, F(z), R, W); g(B, G(A), O, P); g(f, E(p), X, U);
    
    I(&l, 1, V); J(l, &r); e("{"); b(r, 0); e("}\n");
    return 0;
}
