<mstyle mathcolor="red"> x j b , 便 , </mstyle> \color{red}思路就是xjb乱搞,随便跑数据,只要数组 xjb,便,

<mstyle mathcolor="orange"> , </mstyle> \color{orange}够用就一直随机数据,当然也要可以的搞几个让数据 ,

<mstyle mathcolor="green"> , </mstyle> \color{green}一定成立的数据,然后跑一遍生成树 滑稽 ,

#include <bits/stdc++.h>
#pragma GCC optimize(5)
#define ha 10000
#define maxn 20000000
using namespace std ; 
int n , m ,tot ;
int fa[maxn] ;
int find(int x) {
	if(fa[x] != x) fa[x] = find(fa[x]) ;
	return fa[x] ;
}
void unionn(int x ,int y) {
	x = find(x) , y = find(y) ;
	fa[x] = y ;
}
struct dy{
	int x ;int y ;int z ;
}a[maxn] ;
int t ;
void add(int x,int y ,int z) {
	a[++t].x = x ;
	a[t].y = y ;
	a[t].z = z ;
}
int main () {
	srand(time(0)) ;
	cin >> n ;
	freopen("d.in","w",stdout) ;
	cout << n << endl ;
	for(int i = 1 ; i <= n ; i ++) {
		fa[i] = i ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int x = (rand()+ha)%n , y = (rand()+ha)%n , z = rand()%ha ;
		if(x == 0) x = n ;if(y == 0) y = n ;if(z == 0) z = ha ;
		add(x,y,z) ;
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int x = (rand()+ha)%n+1 , y = rand()%n+1 , z = rand()%ha +1;
		add(x,y,z) ;
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int x = (rand()+n)%n+1 , y = (rand()+n)%n+1 , z = rand()%ha +1;
		add(x,y,z) ;
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int x = (rand()+n)%n+1 , y = (rand()+n)%n+1 , z = rand()%ha +1;
		add(x,y,z) ;
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int x = (rand()+n)%n+1 , y = (rand()+n)%n+1 , z = rand()%ha +1;
		add(x,y,z) ;
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int x = (rand()+n)%n+1 , y = (rand()+n)%n+1 , z = rand()%ha +1;
		add(x,y,z) ;
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int x = (rand()+ha)%n+1 , y = (rand()+n)%n+1 , z = rand()%ha +1;
		add(x,y,z) ;
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int x = (rand()+ha)%n+1 , y = (rand()+n)%n+1 , z = rand()%ha +1;
		add(x,y,z) ;
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int x = (rand()+ha)%n+1 , y = (rand()+n)%n+1 , z = rand()%ha +1;
		add(x,y,z) ;
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int x = rand()%n+1 , y = rand()%n +1, z = rand()%ha +1;
		add(x , y , z );
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int opt = rand()%2 ;
		if(opt == 1) 
		add(i,(rand()+ha)%n,rand()%ha) ;
		else add((rand()+ha)%n,i,rand()%ha) ;
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int x = rand()%n +1, y = rand()%n+1 , z = rand()%ha +1;
		add(x , y , z );
		tot ++ ;
	}
	for(int i = 1 ; i <= n ; i ++) {
		int opt = rand()%2 ;
		if(opt == 1) 
		add(i,(rand()+ha)%n,rand()%ha) ;
		else add((rand()+ha)%n,i,rand()%ha) ;
		tot ++ ;
	}
// for(int i = 1 ; i <= n ; i ++) {
// add(i ,(i +2)%n+1 ,rand() % ha+1 );
// tot ++ ;
// }
	int k = 0 ;
	for(int i = 1 ; i <= t ; i ++) {
		if(find(a[i].x) != find(a[i].y)) {
			unionn(a[i].x,a[i].y) ;
			k ++ ;
			cout << a[i].x << " " << a[i].y << " " <<a[i].z <<endl ;;
		}if(k == n-1) break ;
	}
	cout << k << endl ;
	return 0 ;	
}