#include <bits/stdc++.h>
using namespace std;
class DisjointSet {
 public:
  explicit DisjointSet(int n) {
    whichset_ = vector<int>(n);
    height_ = vector<int>(n, 1);
    for (int i = 0; i < n; ++i) whichset_[i] = i;
  }
  int Find(int node) {
    if (whichset_[node] == node) return node;
    return (whichset_[node] = Find(whichset_[node]));
  }
  void Merge(int first_node, int second_node) {
    int h1 = height_[Find(first_node)];
    int h2 = height_[Find(second_node)];
    if (h1 < h2) {
      whichset_[Find(first_node)] = Find(second_node);
      return;
    }
    whichset_[Find(second_node)] = Find(first_node);
    if (h2 < h1) return;
    ++height_[Find(second_node)];
  }

 private:
  vector<int> whichset_;
  vector<int> height_;
};
int fp(int abc, int parent[]) {
  if (parent[abc] == abc) return abc;
  int def = fp(parent[abc], parent);
  parent[abc] = def;
  return def;
}
class UndirectedStronglyConnectedComponents {
 public:
  UndirectedStronglyConnectedComponents(int n) {
    n_ = n;
    adj_ = new vector<int>[n];
    id_ = new vector<int>[n];
    next_id_ = 0;
  }
  ~UndirectedStronglyConnectedComponents() {
    delete[] adj_;
    delete[] id_;
  }
  void add_edge(int a, int b) {
    assert(a >= 0 && b >= 0 && a < n_ && b < n_);
    adj_[a].push_back(b);
    adj_[b].push_back(a);
    id_[a].push_back(next_id_);
    id_[b].push_back(next_id_);
    ++next_id_;
  }
  stack<int> comps_;
  vector<int> visited_;
  DisjointSet* ds_;
  void Dfs(int node, int base, int from_id) {
    assert(visited_[node] == 0);
    visited_[node] = 2;
    comps_.push(node);
    for (int(i) = 0; (i) < (((int)adj_[node].size())); ++(i)) {
      int next = adj_[node][i];
      int idn = id_[node][i];
      if (idn == from_id) continue;
      if (!visited_[next]) {
        Dfs(next, base, idn);
        continue;
      }
      if (visited_[next] == 1) continue;
      while (ds_->Find(comps_.top()) != ds_->Find(next)) {
        ds_->Merge(comps_.top(), node);
        comps_.pop();
      }
      ds_->Merge(comps_.top(), node);
    }
    if (comps_.top() == node) comps_.pop();
    visited_[node] = 1;
  }
  vector<int> solve() {
    while (!comps_.empty()) comps_.pop();
    visited_ = vector<int>(n_, 0);
    ds_ = new DisjointSet(n_);
    for (int i = 0; i < n_; ++i) {
      if (visited_[i]) continue;
      Dfs(i, i, -1);
    }
    vector<int> ret(n_, 0);
    for (int(i) = 0; (i) < (n_); ++(i)) ret[i] = ds_->Find(i);
    delete ds_;
    return ret;
  }
  int n_;
  vector<int>* adj_;
  vector<int>* id_;
  int next_id_;
};
class IdManager {
 public:
  IdManager() {}
  int get(int x) {
    add(x);
    return ids_[x];
  }
  void add(int x) {
    if (ids_.count(x)) return;
    int next_id = ((int)ids_.size());
    ids_[x] = next_id;
  }
  int size() { return ((int)ids_.size()); }
  map<int, int> ids_;
};
string ret[120000];
int a[120000];
int b[120000];
vector<int> id[1005000];
int main() {
  int n, m;
  cin >> n >> m;
  for (int(i) = 0; (i) < (m); ++(i)) {
    int xa, xb, c;
    scanf("%d%d%d", &xa, &xb, &c);
    --xa;
    --xb;
    a[i] = xa;
    b[i] = xb;
    id[c].push_back(i);
  }
  DisjointSet ds(n);
  for (int(i) = 0; (i) < (1005000); ++(i))
    if (((int)id[i].size())) {
      IdManager xy;
      for (typeof((id[i]).begin()) j = (id[i]).begin(); j != (id[i]).end();
           j++) {
        if (ds.Find(a[*j]) == ds.Find(b[*j])) {
          ret[*j] = "none";
          continue;
        } else {
          xy.add(ds.Find(a[*j]));
          xy.add(ds.Find(b[*j]));
        }
      }
      UndirectedStronglyConnectedComponents uscc(xy.size());
      for (typeof((id[i]).begin()) j = (id[i]).begin(); j != (id[i]).end(); j++)
        if (ret[*j] != "none")
          uscc.add_edge(xy.get(ds.Find(a[*j])), xy.get(ds.Find(b[*j])));
      vector<int> components = uscc.solve();
      for (typeof((id[i]).begin()) j = (id[i]).begin(); j != (id[i]).end(); j++)
        if (ret[*j] != "none") {
          int id1 = xy.get(ds.Find(a[*j]));
          int id2 = xy.get(ds.Find(b[*j]));
          if (components[id1] == components[id2]) {
            ret[*j] = "at least one";
          } else {
            ret[*j] = "any";
          }
        }
      for (typeof((id[i]).begin()) j = (id[i]).begin(); j != (id[i]).end(); j++)
        ds.Merge(a[*j], b[*j]);
    }
  for (int(i) = 0; (i) < (m); ++(i)) printf("%s\n", ret[i].c_str());
  return 0;
}
