#include <bits/stdc++.h>
using namespace std;
class Edge {
 public:
  int src, des, weight;
  Edge(int src, int des, int weight) {
    this->src = src;
    this->des = des;
    this->weight = weight;
  }
  bool operator<(const Edge b) const {
    return weight != b.weight ? weight < b.weight
                              : (src < b.src || (src == b.src && des < b.des));
  }
};
class DSU {
  vector<int> p, r;

 public:
  DSU(int size) {
    r.assign(size, 1);
    p.resize(size);
    for (int i = 0; i < size; i++) p[i] = i;
  }
  DSU() {}
  int get(int x) { return p[x] == x ? x : (p[x] = get(p[x])); }
  bool unite(int x, int y) {
    x = get(x);
    y = get(y);
    if (x == y) return false;
    if (r[x] < r[y]) swap(x, y);
    p[y] = x;
    r[x] += r[y];
    return true;
  }
};
vector<pair<Edge, int> > edges;
vector<string> answer;
DSU dsu;
vector<vector<int> > g;
vector<int> u, d, l;
int vertices, edge, globalCounter;
void dfs(int v, int p = -1, int depth = 0) {
  l[v] = d[v] = depth;
  u[v] = globalCounter + 1;
  for (int i = 0; i < (int)g[v].size(); i++) {
    if (g[v][i] == p) continue;
    int id = g[v][i], x = dsu.get(edges[id].first.src),
        y = dsu.get(edges[id].first.des), to = x == v ? y : x;
    if (u[to] > globalCounter)
      l[v] = min(l[v], d[to]);
    else {
      dfs(to, g[v][i], depth + 1);
      l[v] = min(l[v], l[to]);
    }
    if (l[to] > d[v]) {
      answer[edges[g[v][i]].second] = "any";
    }
  }
}
int main() {
  cin >> vertices >> edge;
  d.resize(vertices);
  l.resize(vertices);
  u.resize(vertices);
  g.assign(vertices, vector<int>());
  answer.assign(edge, "at least one");
  dsu = DSU(vertices);
  for (int i = 0; i < edge; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    edges.push_back(make_pair(Edge(x, y, z), i));
  }
  sort(edges.begin(), edges.end());
  for (int i = 0; i < edge;) {
    int k = i;
    while (k < (int)edges.size() &&
           edges[k].first.weight == edges[i].first.weight)
      k++;
    for (int j = i; j < k; j++) {
      int x, y;
      x = dsu.get(edges[j].first.src);
      y = dsu.get(edges[j].first.des);
      if (x != y) {
        g[x].push_back(j);
        g[y].push_back(j);
      } else
        answer[edges[j].second] = "none";
    }
    for (int j = i; j < k; j++) {
      int x, y;
      x = dsu.get(edges[j].first.src);
      y = dsu.get(edges[j].first.des);
      if (u[x] <= globalCounter) dfs(x);
      if (u[y] <= globalCounter) dfs(y);
    }
    for (int j = i; j < k; j++) {
      int x, y;
      x = dsu.get(edges[j].first.src);
      y = dsu.get(edges[j].first.des);
      dsu.unite(x, y);
      g[x].clear();
      g[y].clear();
    }
    i = k;
    globalCounter++;
  }
  for (int i = 0; i < edge; i++) cout << answer[i] << "\n";
  return 0;
}
