#include <bits/stdc++.h>
using namespace std;
const long long MXN = 3e3 + 10;
const long long MXM = 5e2 + 10;
const long long MX5 = 2e5 + 10;
const long long MX6 = 1e6 + 10;
const long long LOG = 20;
const long long INF = 8e18;
const double eps = 1e-9;
const long long MOD = 1e9 + 7;
long long power(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * power(a * a % md, b / 2, md) % md
                      : power(a * a % md, b / 2, md) % md));
}
long long bmm(long long a, long long b) {
  return (a % b == 0 ? b : bmm(b, a % b));
}
string base2(long long n) {
  string a = "";
  while (n >= 2) {
    a += (char)(n % 2 + '0');
    n /= 2;
  }
  a += (char)(n + '0');
  reverse((a).begin(), (a).end());
  return a;
}
long long n, m, ans[MX5], starting_time[MX5], t = 0;
long long par[MX5], SZ[MX5];
vector<pair<long long, long long> > G[MX5];
vector<pair<pair<long long, long long>, long long> > E[MX6];
bool vis[MX5];
void init() {
  for (int i = 0; i <= n; i++) {
    SZ[i] = 1;
    par[i] = i;
  }
  return;
}
long long Find(long long u) {
  if (par[u] == u) {
    return u;
  }
  par[u] = Find(par[u]);
  return par[u];
}
void Union(long long u, long long v) {
  long long p1 = Find(u), p2 = Find(v);
  if (p1 == p2) {
    return;
  }
  if (SZ[p1] > SZ[p2]) {
    par[p2] = p1;
    SZ[p1] += SZ[p2];
  } else {
    par[p1] = p2;
    SZ[p2] += SZ[p1];
  }
  return;
}
long long DFS(long long u, long long par, long long ID) {
  vis[u] = 1;
  starting_time[u] = t++;
  long long mini = INF;
  for (auto pr : G[u]) {
    long long v = pr.first, id = pr.second;
    if (!vis[v]) {
      long long now = DFS(v, u, id);
      mini = min(mini, now);
      if (now <= starting_time[u]) {
        ans[id] = 2;
      }
    } else if (v != par) {
      ans[id] = 2;
      mini = min(mini, starting_time[v]);
    } else if (ID != id) {
      ans[id] = 2;
      ans[ID] = 2;
    }
  }
  return mini;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  init();
  for (int i = 0; i < m; i++) {
    long long u, v, w;
    cin >> u >> v >> w;
    E[w].push_back({{u, v}, i});
  }
  for (int i = 1; i < MX6; i++) {
    if (E[i].empty()) continue;
    for (int j = 0; j < E[i].size(); j++) {
      long long u = E[i][j].first.first, v = E[i][j].first.second,
                id = E[i][j].second;
      long long p1 = Find(u), p2 = Find(v);
      if (p1 == p2) {
        ans[id] = 1;
        continue;
      }
      vis[p1] = 0, vis[p2] = 0, G[p1].clear(), G[p2].clear();
    }
    for (int j = 0; j < E[i].size(); j++) {
      long long u = E[i][j].first.first, v = E[i][j].first.second,
                id = E[i][j].second;
      long long p1 = Find(u), p2 = Find(v);
      if (p1 == p2) {
        continue;
      }
      G[p1].push_back({p2, id});
      G[p2].push_back({p1, id});
    }
    for (int j = 0; j < E[i].size(); j++) {
      long long u = Find(E[i][j].first.first);
      if (!vis[u]) {
        t = 0;
        long long Trash = DFS(u, -1, -1);
      }
    }
    for (int j = 0; j < E[i].size(); j++) {
      long long u = E[i][j].first.first, v = E[i][j].first.second;
      Union(u, v);
    }
  }
  for (int i = 0; i < m; i++) {
    if (ans[i] == 0) {
      cout << "any" << '\n';
    } else if (ans[i] == 1) {
      cout << "none" << '\n';
    } else {
      cout << "at least one" << '\n';
    }
  }
  return 0;
}
