#include <bits/stdc++.h>
using namespace std;
using INT = long long;
using VI = vector<int>;
using pii = pair<int, int>;
template <typename A, typename B>
void smin(A &a, const B &b) {
  if (a > b) a = b;
}
template <typename A, typename B>
void smax(A &a, const B &b) {
  if (a < b) a = b;
}
int U[101010], V[101010], W[101010], id[101010];
int root[101010], ans[101010];
int head[101010], nxt[202020], to[202020], E;
int vst[101010], low[101010], bel[101010], st[101010];
int cnt, top, ind;
void add(int u, int v) { to[E] = v, nxt[E] = head[u], head[u] = E++; }
void init(int N) {
  E = cnt = ind = 0;
  for (int i = N; i--;) {
    vst[i] = 0, head[i] = -1;
  }
}
void dfs(int u, int pre = -1) {
  vst[u] = low[u] = ++ind;
  st[++top] = u;
  for (int e = head[u]; e != -1; e = nxt[e]) {
    int v = to[e];
    if (!vst[v])
      dfs(v, e), low[u] = min(low[u], low[v]);
    else if ((pre ^ e) != 1)
      low[u] = min(low[u], vst[v]);
  }
  if (vst[u] == low[u]) {
    ++cnt;
    while (1) {
      bel[st[top]] = cnt;
      if (st[top--] == u) break;
    }
  }
}
VI vec;
int find(int u) { return root[u] == u ? u : root[u] = find(root[u]); }
int Id[101010];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", U + i, V + i, W + i);
    id[i] = i;
  }
  sort(id, id + m, [&](int u, int v) { return W[u] < W[v]; });
  for (int i = 1; i <= n; i++) root[i] = i;
  for (int i = 0, j = 0; i < m; i = j) {
    vec.clear();
    for (; j < m && W[id[i]] == W[id[j]]; j++) {
      int I = id[j];
      int u = find(U[I]), v = find(V[I]);
      if (u == v) continue;
      vec.push_back(u), vec.push_back(v);
    }
    sort(vec.begin(), vec.end());
    vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
    int N = vec.size();
    init(N);
    for (int k = 0; k < N; k++) Id[vec[k]] = k;
    for (int k = i; k < j; k++) {
      int I = id[k];
      int u = find(U[I]), v = find(V[I]);
      if (u == v) continue;
      u = Id[u], v = Id[v];
      add(u, v), add(v, u);
    }
    for (int k = N; k--;)
      if (!vst[k]) {
        dfs(k);
      }
    for (int k = i; k < j; k++) {
      int I = id[k];
      int u = find(U[I]), v = find(V[I]);
      if (u == v) continue;
      u = Id[u], v = Id[v];
      if (bel[u] != bel[v])
        ans[I] = 1;
      else
        ans[I] = 2;
    }
    for (int k = i; k < j; k++) {
      int I = id[k];
      int u = find(U[I]), v = find(V[I]);
      root[u] = v;
    }
  }
  for (int i = 0; i < m; i++) {
    if (ans[i] == 0)
      puts("none");
    else if (ans[i] == 1)
      puts("any");
    else
      puts("at least one");
  }
}
