#include <bits/stdc++.h>
using namespace std;
int R = 1e9 + 7;
template <typename T>
T last(vector<T>& v) {
  return v[v.size() - 1];
}
template <typename T>
void print(vector<T>& v) {
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << ' ';
  }
  cout << endl;
}
template <typename T1, typename T2>
void print(vector<pair<T1, T2>>& v) {
  cout << "[";
  for (int i = 0; i < v.size(); i++) {
    cout << '(' << v[i].first << ',' << v[i].second << "),";
  }
  cout << "]" << endl;
}
template <typename T>
void print(vector<vector<T>>& v) {
  cout << "[";
  for (int i = 0; i < v.size(); i++) {
    print(v[i]);
  }
  cout << "]" << endl;
}
template <typename T>
void print(set<T>& v) {
  cout << "{";
  for (auto i : v) {
    cout << i << ' ';
  }
  cout << "}" << endl;
}
template <typename T1, typename T2>
void print(map<T1, T2>& v) {
  cout << "{";
  for (auto i : v) {
    cout << i.first << ':' << i.second << ',';
  }
  cout << "}" << endl;
}
template <typename T>
bool in(set<T>& indices, T x) {
  return indices.find(x) != indices.end();
}
template <typename T, typename T_>
bool in(map<T, T_>& indices, T x) {
  return indices.find(x) != indices.end();
}
int power(int x, int y) {
  int res = 1;
  x = x % R;
  if (x == 0) return 0;
  while (y > 0) {
    if (y % 2 == 1) res = (res * x) % R;
    y /= 2;
    x = (x * x) % R;
  }
  return res;
}
bool compare(int a, int b) { return (a < b); }
vector<int> parent;
vector<int> set_size;
void make_set(int v) {
  parent[v] = v;
  set_size[v] = 1;
}
int find_set(int v) {
  if (v == parent[v]) return v;
  return parent[v] = find_set(parent[v]);
}
void union_sets(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (set_size[a] < set_size[b]) swap(a, b);
    parent[b] = a;
    set_size[a] += set_size[b];
  }
}
map<pair<int, int>, string> label;
map<int, vector<pair<int, pair<int, int>>>> adj;
map<int, bool> visited;
map<int, int> tin, low;
int timer;
void dfs(int v, int p = -1) {
  visited[v] = true;
  tin[v] = low[v] = timer++;
  bool parent_counted = false;
  for (auto to_ : adj[v]) {
    int to = to_.first;
    if (to == p && !parent_counted) {
      parent_counted = true;
      continue;
    }
    if (visited[to]) {
      low[v] = min(low[v], tin[to]);
    } else {
      dfs(to, v);
      low[v] = min(low[v], low[to]);
      if (low[to] > tin[v]) {
        label[to_.second] = "any";
      }
    }
  }
}
void find_bridges() {
  int n = (int)adj.size();
  timer = 0;
  for (auto& i_ : adj) {
    int i = i_.first;
    visited[i] = false;
    tin[i] = -1;
    low[i] = -1;
  }
  for (auto& i_ : adj) {
    int i = i_.first;
    if (!visited[i]) dfs(i);
  }
}
void TestCase() {
  int n, m;
  cin >> n >> m;
  parent.resize(n);
  set_size.resize(n);
  for (int i = 0; i < n; i++) make_set(i);
  vector<pair<int, int>> all;
  map<int, vector<pair<int, int>>> edges;
  for (int i = 0; i < m; i++) {
    int a, b, w;
    cin >> a >> b >> w;
    a--;
    b--;
    if (!in(edges, w)) edges[w] = vector<pair<int, int>>(0);
    edges[w].push_back({a, b});
    all.push_back({a, b});
  }
  for (auto i : edges) {
    vector<pair<int, int>> u;
    for (auto e : i.second) {
      if (find_set(e.first) == find_set(e.second)) {
        label[e] = "none";
      } else
        u.push_back(e);
    }
    for (auto e : u) {
      int a = find_set(e.first);
      int b = find_set(e.second);
      if (!in(adj, a)) adj[a] = vector<pair<int, pair<int, int>>>(0);
      if (!in(adj, b)) adj[b] = vector<pair<int, pair<int, int>>>(0);
      adj[a].push_back(make_pair(b, e));
      adj[b].push_back(make_pair(a, e));
    }
    find_bridges();
    for (auto e : i.second) {
      union_sets(e.first, e.second);
    }
    adj.clear();
  }
  for (auto e : all) {
    if (in(label, e)) {
      cout << label[e] << '\n';
    } else if (in(label, make_pair(e.second, e.first))) {
      cout << label[make_pair(e.second, e.first)] << '\n';
    } else
      cout << "at least one" << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T;
  T = 1;
  for (int tt = 1; tt <= T; tt++) {
    TestCase();
  }
}
