#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 7;
pair<pair<int, int>, pair<int, int> > p[MAXN];
int n, m, ans[MAXN], fa[MAXN], mx[MAXN], pos[MAXN] = {}, cnt, num[MAXN],
                                         low[MAXN], cur = 0;
vector<pair<int, int> > adj[MAXN];
bitset<MAXN> vis;
int root(int u) {
  if (fa[u] < 0) return u;
  return fa[u] = root(fa[u]);
}
void dfs(int u, int p) {
  num[u] = low[u] = ++cnt;
  vis[u] = 1;
  for (auto it : adj[u]) {
    int id = it.second, v = it.first;
    if (id != p) {
      if (vis[v])
        low[u] = min(low[u], num[v]);
      else {
        dfs(v, id);
        low[u] = min(low[u], low[v]);
        if (low[v] == num[v]) ans[id] = 1;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) fa[i] = -1;
  for (int i = 1; i <= m; ++i)
    cin >> p[i].second.first >> p[i].second.second >> p[i].first.first,
        p[i].first.second = i;
  sort(p + 1, p + 1 + m);
  for (int i = 1; i <= m; ++i) {
    int j = i;
    vector<int> cur;
    int u = root(p[i].second.first), v = root(p[i].second.second),
        id = p[i].first.second;
    if (u != v) {
      if (pos[u] != j) adj[u].clear(), pos[u] = j, cur.push_back(u);
      if (pos[v] != j) adj[v].clear(), pos[v] = j, cur.push_back(v);
      adj[v].push_back({u, id}), adj[u].push_back({v, id});
    } else
      ans[id] = -1;
    while (p[i + 1].first.first == p[i].first.first) {
      ++i;
      int u = root(p[i].second.first), v = root(p[i].second.second),
          id = p[i].first.second;
      if (u != v) {
        if (pos[u] != j) adj[u].clear(), pos[u] = j, cur.push_back(u);
        if (pos[v] != j) adj[v].clear(), pos[v] = j, cur.push_back(v);
        adj[v].push_back({u, id}), adj[u].push_back({v, id});
      } else
        ans[id] = -1;
    }
    cnt = 0;
    for (auto u : cur) vis[u] = 0;
    for (auto u : cur)
      if (!vis[u]) dfs(u, 0);
    for (int t = j; t <= i; ++t) {
      int u = root(p[t].second.first), v = root(p[t].second.second);
      if (u != v) fa[u] = v;
    }
  }
  for (int i = 1; i <= m; ++i)
    cout << (ans[i] ? (ans[i] == -1 ? "none" : "any") : "at least one") << '\n';
  return 0;
}
