#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
int n, m, U[N], V[N], weight[N], height[N], par[N], up[N], answer[N];
bool visited[N];
vector<int> vec[N], adj[N];
map<pair<int, int>, int> edges;
int parent(int u) {
  if (par[u] == u) {
    return u;
  } else {
    par[u] = parent(par[u]);
    return par[u];
  }
}
int dfs(int u, int par = -1) {
  visited[u] = true;
  up[u] = height[u];
  bool seen = false;
  for (int v : adj[u]) {
    if (v == par && seen == false) {
      seen = true;
    } else if (visited[v] == true) {
      up[u] = min(up[u], height[v]);
    } else {
      height[v] = height[u] + 1;
      int x = dfs(v, u);
      if (x > height[u]) {
        answer[edges[pair<int, int>(v, u)]]++;
      }
      up[u] = min(up[u], x);
    }
  }
  return up[u];
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    par[i] = i;
  }
  for (int i = 0; i < m; i++) {
    cin >> U[i] >> V[i] >> weight[i];
    U[i]--;
    V[i]--;
    vec[weight[i]].push_back(i);
  }
  for (int i = 0; i < N; i++) {
    edges.clear();
    vector<int> h;
    for (int j : vec[i]) {
      int u = parent(U[j]), v = parent(V[j]);
      if (u != v) {
        answer[j] = 1;
        edges[pair<int, int>(u, v)] = j;
        edges[pair<int, int>(v, u)] = j;
        adj[u].push_back(v);
        adj[v].push_back(u);
        h.push_back(u);
        h.push_back(v);
      }
    }
    for (int j : h) {
      if (visited[j] == false) {
        dfs(j);
      }
    }
    for (int j : h) {
      adj[j].clear(), visited[j] = false;
    }
    for (int j : vec[i]) {
      par[parent(U[j])] = parent(V[j]);
    }
  }
  for (int i = 0; i < m; i++) {
    if (answer[i] > 1) {
      cout << "any" << endl;
    } else if (answer[i] == 1) {
      cout << "at least one" << endl;
    } else {
      cout << "none" << endl;
    }
  }
}
