#include <bits/stdc++.h>
using namespace std;
const int N = 100 * 1000 + 20;
int n, m, v[N], u[N], w[N], ans[N], h[N], sz[N], par[N];
bool mark[N];
vector<int> edge[10 * N];
vector<pair<int, int> > adj[N];
string s[3] = {"none", "at least one", "any"};
vector<int> ver;
int find_root(int v) { return ~par[v] ? par[v] = find_root(par[v]) : v; }
void merge(int idx) {
  int vv = find_root(v[idx]), uu = find_root(u[idx]);
  if (vv == uu) return;
  if (sz[vv] < sz[uu]) swap(vv, uu);
  par[uu] = vv;
  sz[vv] += sz[uu];
}
int dfs(int v, int last = -1) {
  mark[v] = true;
  int res = h[v];
  for (auto u : adj[v]) {
    if (u.second == last) continue;
    if (mark[u.first])
      res = min(res, h[u.first]);
    else {
      h[u.first] = h[v] + 1;
      res = min(res, dfs(u.first, u.second));
    }
  }
  if (res == h[v] && ~last) ans[last] = 2;
  if (~last) res = min(res, h[v] - 1);
  return res;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> v[i] >> u[i] >> w[i];
    v[i]--, u[i]--;
    edge[w[i]].push_back(i);
  }
  memset(par, -1, sizeof par);
  fill(sz, sz + n, 1);
  fill(ans, ans + m, 1);
  for (int i = 1; i <= 1000 * 1000; i++) {
    for (auto j : edge[i]) {
      int vv = find_root(v[j]), uu = find_root(u[j]);
      if (vv == uu)
        ans[j] = 0;
      else {
        ver.push_back(vv);
        ver.push_back(uu);
        adj[vv].push_back(pair<int, int>(uu, j));
        adj[uu].push_back(pair<int, int>(vv, j));
      }
    }
    for (auto v : ver)
      if (!mark[v]) dfs(v);
    for (auto v : ver) {
      mark[v] = false;
      h[v] = 0;
      adj[v].clear();
    }
    ver.clear();
    for (auto j : edge[i]) merge(j);
  }
  for (int i = 0; i < m; i++) cout << s[ans[i]] << "\n";
  return 0;
}
