#include <bits/stdc++.h>
using namespace std;
enum { ANY = 0, ALONE = 1, NONE = 2 };
const int MAX = 1e5 + 5;
constexpr int LOGMAX = 31 - __builtin_clz(MAX) + 5;
vector<int> adj[MAX];
map<pair<int, int>, int> id;
map<int, int> info[MAX];
int pset[MAX], ans[MAX];
bool in_mst[MAX];
int n, m;
int find_set(int i) { return pset[i] == i ? i : pset[i] = find_set(pset[i]); }
inline bool same_set(int i, int j) { return find_set(i) == find_set(j); }
inline void union_sets(int i, int j) { pset[find_set(i)] = find_set(j); }
int L[MAX], P[LOGMAX][MAX], M[LOGMAX][MAX], st[MAX], en[MAX];
vector<tuple<int, int, int> > edges;
int dfs_c = 1;
void dfs(int source, int father) {
  st[source] = dfs_c++;
  for (auto &each : adj[source]) {
    if (each != father) {
      P[0][each] = source;
      M[0][each] = get<0>(
          edges[id[pair<int, int>(min(each, source), max(each, source))]]);
      L[each] = L[source] + 1;
      dfs(each, source);
    }
  }
  en[source] = dfs_c - 1;
}
pair<int, int> lca(int a, int b) {
  if (L[a] > L[b]) {
    swap(a, b);
  }
  int lg = 31 - __builtin_clz(L[b]);
  int maxx = -(1 << 30);
  for (int i = int(lg); i >= int(0); i--) {
    if (L[b] - (1 << i) >= L[a]) {
      maxx = max(maxx, M[i][b]);
      b = P[i][b];
    }
  }
  if (a == b) {
    return pair<int, int>(a, maxx);
  }
  lg = 31 - __builtin_clz(L[b]);
  for (int i = int(lg); i >= int(0); i--) {
    if (P[i][a] != P[i][b]) {
      maxx = max(maxx, M[i][a]);
      maxx = max(maxx, M[i][b]);
      a = P[i][a];
      b = P[i][b];
    }
  }
  return pair<int, int>(P[0][a], max({maxx, M[0][a], M[0][b]}));
}
void phase_out(int source) {
  for (auto &each : adj[source]) {
    if (each == P[0][source]) {
      continue;
    }
    phase_out(each);
    int edge_id = id[pair<int, int>(min(each, source), max(each, source))];
    int edge_w = get<0>(edges[edge_id]);
    if (info[each].count(edge_w)) {
      if (st[info[each][edge_w]] <= st[source]) {
        ans[edge_id] = ALONE;
      }
    }
    for (auto &p : info[each]) {
      if (info[source].count(p.first)) {
        if (st[p.second] < st[info[source][p.first]]) {
          info[source][p.first] = p.second;
        }
      } else {
        info[source][p.first] = p.second;
      }
    }
  }
}
int main() {
  scanf("%d %d", &n, &m);
  priority_queue<tuple<int, int, int>, vector<tuple<int, int, int> >,
                 greater<tuple<int, int, int> > >
      pq;
  for (int i = int(0); i < int(m); i++) {
    int a, b, w;
    scanf("%d %d %d", &a, &b, &w);
    id[pair<int, int>(min(a, b), max(a, b))] = i;
    pq.emplace(w, a, b);
    edges.emplace_back(w, a, b);
  }
  for (int i = int(1); i < int(n + 1); i++) {
    pset[i] = i;
  }
  int n_sets = n;
  while (n_sets > 1 && !pq.empty()) {
    auto e = pq.top();
    pq.pop();
    int w, u, v;
    tie(w, u, v) = e;
    if (!same_set(u, v)) {
      union_sets(u, v);
      in_mst[id[pair<int, int>(min(u, v), max(u, v))]] = true;
      adj[u].push_back(v);
      adj[v].push_back(u);
      n_sets--;
    }
  }
  memset(P, -1, sizeof P);
  dfs(1, -1);
  for (int i = int(1); i < int(LOGMAX); i++) {
    for (int j = int(1); j < int(n + 1); j++) {
      if (P[i - 1][j] != -1) {
        P[i][j] = P[i - 1][P[i - 1][j]];
        M[i][j] = max(M[i - 1][j], M[i - 1][P[i - 1][j]]);
      }
    }
  }
  for (int i = int(0); i < int(edges.size()); i++) {
    if (!in_mst[i]) {
      int w, u, v;
      tie(w, u, v) = edges[i];
      pair<int, int> p = lca(u, v);
      if (w > p.second) {
        ans[i] = NONE;
      } else {
        ans[i] = ALONE;
        if (!info[u].count(w)) {
          info[u][w] = p.first;
        } else if (st[info[u][w]] > st[p.first]) {
          info[u][w] = p.first;
        }
        if (!info[v].count(w)) {
          info[v][w] = p.first;
        } else if (st[info[v][w]] > st[p.first]) {
          info[v][w] = p.first;
        }
      }
    }
  }
  phase_out(1);
  for (int i = int(0); i < int(m); i++) {
    if (ans[i] == ANY) {
      puts("any");
    } else if (ans[i] == ALONE) {
      puts("at least one");
    } else {
      puts("none");
    }
  }
  return 0;
}
