#include <stdio.h>
#include <malloc.h>

struct rocker {
    int data; //保存するデータ
    struct rocker *next; //次のボックスのアドレス(鍵)
};

struct rocker *head;

struct rocker *new_rocker(struct rocker *last_rocker)
{
	struct rocker *pt;

	pt = malloc(sizeof (struct rocker));
	if (last_rocker) {
		last_rocker->next = pt;
	}
	return pt;
}

void display_rockers(struct rocker *pt)
{
	for ( ; pt; pt = pt->next) {
		if (pt->next) {
			printf("[ data = %d ]->", pt->data);
		} else {
			printf("[ data = %d ]\n", pt->data);
		}
	}
}

int main()
{
	struct rocker *last_rocker;
	struct rocker *next;
	int i, n;

	scanf("%d", &n);
	last_rocker = NULL;
	for (i = 0; i < n; i++) {
		last_rocker = new_rocker(last_rocker);
		if (i == 0) {
			head = last_rocker;
		}
		scanf("%d", &last_rocker->data);
	}
	last_rocker->next = NULL;
	display_rockers(head);
	for (last_rocker = head; last_rocker; last_rocker = next) {
		next = last_rocker->next;
		free(last_rocker);
	}
	return 0;
}
