#include <bits/stdc++.h>
using namespace std;
void __print(long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  long long f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
inline long long GCD(long long x, long long y) {
  long long r = x % y;
  while (r) {
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}
const long long N = 1e6 + 69;
long long timer;
vector<long long> adj[N];
bool vis[N];
long long low[N];
long long arr[N];
vector<pair<long long, pair<long long, long long>>> v;
vector<pair<long long, long long>> ord;
map<pair<long long, long long>, long long> mm;
map<pair<long long, long long>, long long> edgecount;
void dfs(long long v, long long p = -1) {
  vis[v] = true;
  arr[v] = low[v] = timer++;
  for (long long x : adj[v]) {
    long long to = x;
    if (to == p) continue;
    if (vis[to]) {
      low[v] = min(low[v], arr[to]);
    } else {
      dfs(to, v);
      low[v] = min(low[v], low[to]);
      if (low[to] > arr[v] && edgecount[{to, v}] == 1) {
        ;
        mm[{to, v}]++;
        mm[{v, to}]++;
      }
    }
  }
}
void find_bridges(long long n) {
  timer = 0;
  for (long long i = 0; i < n; i++) {
    vis[i] = 0;
    arr[i] = -1;
    low[i] = -1;
  }
  for (long long i = 0; i < n; ++i) {
    if (!vis[i]) dfs(i);
  }
}
long long sze[N], parent[N];
void make_set(long long v) {
  parent[v] = v;
  sze[v] = 1;
}
long long find_set(long long v) {
  if (v == parent[v]) return v;
  return parent[v] = find_set(parent[v]);
}
void union_set(long long a, long long b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (sze[a] < sze[b]) swap(a, b);
    parent[b] = a;
    sze[a] += sze[b];
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < m; i++) {
    long long x, y, z;
    cin >> x >> y >> z;
    ord.push_back({x, y});
    v.push_back({z, {x, y}});
  }
  dfs(1, 0);
  ;
  map<pair<long long, long long>, string> ans;
  for (long long i = 1; i <= n; i++) make_set(i);
  sort(v.begin(), v.end());
  ;
  for (long long i = 0; i < (long long)v.size(); i++) {
    long long p = v[i].second.first;
    long long q = v[i].second.second;
    long long w = v[i].first;
    vector<pair<long long, long long>> temp;
    temp.push_back({p, q});
    long long x = w;
    while (i + 1 < (long long)v.size() && v[i + 1].first == x) {
      temp.push_back({v[i + 1].second.first, v[i + 1].second.second});
      i++;
    };
    mm.clear();
    long long cnt = 0;
    map<long long, long long> buddy;
    vector<pair<long long, long long>> poki;
    for (pair<long long, long long> erin : temp) {
      p = erin.first;
      q = erin.second;
      if (find_set(p) == find_set(q)) {
        ans[{p, q}] = "none";
        ans[{q, p}] = "none";
      } else {
        poki.push_back({erin});
        if (buddy.find(find_set(p)) == buddy.end()) buddy[find_set(p)] = cnt++;
        if (buddy.find(find_set(q)) == buddy.end()) buddy[find_set(q)] = cnt++;
      }
    };
    edgecount.clear();
    for (long long i = 0; i <= cnt; i++) adj[i].clear();
    for (pair<long long, long long> erin : poki) {
      long long var1 = find_set(erin.first);
      long long var2 = find_set(erin.second);
      long long point1 = buddy[var1];
      long long point2 = buddy[var2];
      ;
      edgecount[{point1, point2}]++;
      edgecount[{point2, point1}]++;
      adj[point1].push_back(point2);
      adj[point2].push_back(point1);
    }
    find_bridges(cnt);
    for (pair<long long, long long> erin : poki) {
      p = erin.first;
      q = erin.second;
      long long var1 = buddy[find_set(erin.first)];
      long long var2 = buddy[find_set(erin.second)];
      if (mm[{var1, var2}]) {
        ans[{p, q}] = "any";
        ans[{q, p}] = "any";
      } else {
        ans[{p, q}] = "at least one";
        ans[{q, p}] = "at least one";
      }
    }
    for (pair<long long, long long> erin : poki) {
      p = erin.first;
      q = erin.second;
      union_set(p, q);
    }
  }
  for (pair<long long, long long> x : ord) cout << ans[x] << '\n';
  return 0;
}
