#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for (int i=s;i<=t;i++)
#define pi acos(-1)
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef pair<PII, PII> PPP;
typedef pair<PII, int> PPI;
#define repp(i,s,t) for (int i=s;i>=t;i--)
template<class T> T sqr(T x) {return x*x;}
#define debug(x) cerr<<#x"="<<(x)<<endl;
#define pb(x) push_back(x);
#define ori(x) x-'a'
const int maxn = 200001;
int ans[maxn * 2], ind[maxn];
vector<PII> g[maxn], at[maxn];
int posi[maxn];
int n, m, x, y, z;
int used[maxn];
int p[3], lb[3];
queue<int> q;
int cnt;
int s[maxn];
int main()
{
	freopen("insider.in","r",stdin);
	freopen("insider.out","w",stdout);
	scanf("%d%d",&n,&m);
	rep(i,1,m)
	{
		scanf("%d%d%d",&x,&y,&z);
		g[x].push_back(PII(y, i));
		g[z].push_back(PII(y, i));
		at[x].push_back(PII(y, z));
	//	at2[y].push_back(PII(x, z));
		at[z].push_back(PII(y, x));
		ind[y]+=2;
	}
	rep(i,1,n) if (!ind[i]) q.push(i);
	while (!q.empty())
	{
		int x = q.front();
		s[++cnt] = x;
		q.pop();
		for (int i = 0; i < g[x].size(); i++)
		{
			if (used[g[x][i].second]) continue;
			int v = g[x][i].first;
			used[g[x][i].second] = 1;
			ind[v] -= 2;
			if (!ind[v]) q.push(v);
		}
	}
	int sub;
	int h[3], sg[3];
	if (n % 2 == 1)
	{
		sub = 1;
		h[0] = n;
		h[1] = n+2;
		ans[n + 1] = s[n];
		posi[s[n]] = n + 1;
	}
	else
	{
		sub = 2;
		h[0] = n - 1;
		h[1] = n + 2;
		ans[n] = s[n - 1];
		posi[s[n - 1]] = n;
		ans[n + 1] = s[n];
		posi[s[n]] = n + 1;
	}
	repp(ii, n-sub , 1)
	{
		x = s[ii];
		int cnt1 = 0, cnt2 = 0;
		for (int i = 0; i < at[x].size(); i++)
		{
			int u = posi[at[x][i].first];
			int v = posi[at[x][i].second];
			if ((!u) || (!v)) continue;
			if (u < v) cnt1++;
			else cnt2++;
		}
		if (cnt2 > cnt1)
		{
			ans[h[1]] = x;
			posi[x] = h[1]++;
		}
		else
		{
			ans[h[0]] = x;
			posi[x] = h[0]--;
		}
	}
	rep(i,h[0] + 1, h[1] - 1) printf("%d%c", ans[i], i==(h[1]-1)?'\n':' ');
}
