#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1, M = 1e6 + 1;
int n, m, dsu[N], pre[N], low[N];
vector<tuple<int, int, int> > edges[M];
vector<pair<int, int> > g[N];
string res[N];
int root(int v) { return (dsu[v] < 0 ? v : dsu[v] = root(dsu[v])); }
int idx;
void dfs(int u, int p) {
  pre[u] = low[u] = ++idx;
  map<int, int> mp;
  for (auto e : g[u]) {
    int v, i;
    tie(v, i) = e;
    if (mp.count(v)) res[mp[v]] = "at least one";
    mp[v] = i;
    if (v == p) continue;
    if (!pre[v]) {
      dfs(v, u);
      low[u] = min(low[v], low[u]);
      if (low[v] > pre[u]) res[i] = "any";
    } else
      low[u] = min(pre[v], low[u]);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  fill(dsu + 1, dsu + n + 1, -1);
  fill(res, res + m, string("at least one"));
  for (int i = 0, u, v, w; i < m; i++) {
    cin >> u >> v >> w;
    edges[w].emplace_back(u, v, i);
  }
  for (int w = 1; w < M; w++) {
    vector<int> ls;
    for (auto e : edges[w]) {
      int u, v, i;
      tie(u, v, i) = e;
      u = root(u), v = root(v);
      if (u == v) {
        res[i] = "none";
        continue;
      }
      g[u].emplace_back(v, i);
      g[v].emplace_back(u, i);
      ls.push_back(u);
      ls.push_back(v);
    }
    for (int v : ls)
      if (!pre[v]) dfs(v, -1);
    for (int v : ls) {
      g[v].clear();
      pre[v] = low[v] = 0;
      idx = 0;
    }
    for (auto e : edges[w]) {
      int u, v, i;
      tie(u, v, i) = e;
      u = root(u), v = root(v);
      if (u == v) continue;
      if (dsu[u] > dsu[v]) swap(u, v);
      dsu[u] += dsu[v];
      dsu[v] = u;
    }
  }
  for (int i = 0; i < m; i++) cout << res[i] << '\n';
}
