/*
Algorithm: 链式前向星 
Author: anthony1314
Creat Time:
Time Complexity:
*/

#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<stack>
#include<cstring>
#include<cstdio>
//#include<bits/stdc++.h>
#define ll long long
//#define maxn 1005
#define mod 1e9 + 7
#define line printf("--------------");
using namespace std;
#define maxn  100005
int head[maxn];
int tot;
struct node{
	int u, v, w;
	int next;
};
node edge[maxn];
void init() {
	tot = 0;
	memset(head, -1, sizeof(head));
}
void addedge(int u, int v, int w){
	++tot;
	edge[tot].u = u, edge[tot].v = v, edge[tot].w = w;
	edge[tot].next = head[u];
	head[u]= tot;
}
int main() {
	int num, tot;
	cin>>num>>tot;//点的个数   边的数量 
	init();//初始化 
	int a, b, c;
	for(int i = 0; i < tot; i++){
		scanf("%d %d %d", &a, &b, &c);
		addedge(a, b, c);//单向边 
//		addedge(b, a, c);
	}
	for(int u = 1; u <= num; u++){
		printf("-----------------------\n"); 
		for(int i = head[u]; i != -1; i = edge[i].next){
			int u = edge[i].u;
			int v = edge[i].v;
			int w = edge[i].w;
			printf("====%d %d %d====\n", u, v, w);
		}
	}
	return 0;
}
/* 
5 10
1 4 5
1 2 5
1 3 5
4 2 5
4 1 5
4 3 2
2 1 5
2 3 5
2 5 5
3 1 5 
*/