#include <bits/stdc++.h>
const int INF = (int)1e9;
const double EPS = 0.000000000000001;
const double PI = acos(-1.0);
const int MOD = 1e9 + 7;
using namespace std;
void fast_io() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void file_in(const string& filename) { freopen(filename.c_str(), "r", stdin); }
void file_out(const string& filename) {
  freopen(filename.c_str(), "w", stdout);
}
double diffclock(clock_t clock1, clock_t clock2) {
  double diffticks = clock2 - clock1;
  return diffticks / ((double)CLOCKS_PER_SEC / 1000);
}
void sleep(int milliseconds) {
  clock_t start = clock();
  for (clock_t end = clock(); diffclock(start, end) < milliseconds;
       end = clock()) {
  }
}
struct Edge {
  int from;
  int to;
  int weight;
  int id;
  Edge() {
    from = to = id = -1;
    weight = INF;
  }
  Edge(int from, int to, int weight, int id)
      : from(from), to(to), weight(weight), id(id) {}
};
struct GraphEdge {
  int to;
  int id;
  GraphEdge() { to = id = -1; }
  GraphEdge(int to, int id) : to(to), id(id) {}
};
struct DSU {
  vector<int> parent;
  vector<int> rank;
  int count;
  DSU(int size = -1) { rebuild(size); }
  void rebuild(int size = -1) {
    if (size != -1) {
      parent.resize(size);
      rank.resize(size);
    }
    iota(parent.begin(), parent.end(), 0);
    rank.assign(rank.size(), 0);
    count = size;
  }
  int get(int u) {
    if (parent[u] == u) {
      return u;
    }
    return parent[u] = get(parent[u]);
  }
  void unite(int u, int v) {
    u = get(u);
    v = get(v);
    if (u == v) {
      return;
    }
    if (rank[u] > rank[v]) {
      swap(u, v);
    }
    if (rank[u] == rank[v]) {
      ++rank[v];
    }
    parent[u] = v;
    --count;
  }
  bool check(int u, int v) { return get(u) == get(v); }
};
vector<int> answer;
vector<GraphEdge>* graph;
vector<char> used;
vector<int> tin;
vector<int> fup;
int timer;
void dfs(int v, int p = -1) {
  used[v] = 1;
  tin[v] = fup[v] = timer++;
  for (GraphEdge& edge : graph[v]) {
    if (edge.id != p) {
      if (used[edge.to]) {
        fup[v] = min(fup[v], tin[edge.to]);
      } else {
        dfs(edge.to, edge.id);
        fup[v] = min(fup[v], fup[edge.to]);
        if (fup[edge.to] > tin[v]) {
          answer[edge.id] = 2;
        }
      }
    }
  }
}
void Tarjan(int n, vector<Edge>& edges) {
  int m = edges.size();
  auto cmp = [](const Edge& a, const Edge& b) {
    return tie(a.weight) < tie(b.weight);
  };
  sort(edges.begin(), edges.end(), cmp);
  DSU dsu(n);
  graph = new vector<GraphEdge>[n];
  used.resize(n);
  tin.resize(n);
  fup.resize(n);
  for (int i = 0; i < m; ++i) {
    int j;
    for (j = i; (j + 1 < m) && (edges[j + 1].weight == edges[i].weight); ++j) {
    }
    unordered_set<int> touched;
    for (int cur = i; cur <= j; ++cur) {
      if (dsu.check(edges[cur].from, edges[cur].to)) {
        answer[edges[cur].id] = 1;
        continue;
      }
      int u, v;
      u = dsu.get(edges[cur].from);
      v = dsu.get(edges[cur].to);
      graph[u].emplace_back(v, edges[cur].id);
      graph[v].emplace_back(u, edges[cur].id);
      touched.insert(u);
      touched.insert(v);
    }
    timer = 0;
    for (int cur : touched) {
      if (!used[cur]) {
        dfs(cur);
      }
    }
    for (int cur : touched) {
      used[cur] = 0;
    }
    for (int cur = i; cur <= j; ++cur) {
      dsu.unite(edges[cur].from, edges[cur].to);
    }
    for (int cur : touched) {
      graph[cur].clear();
    }
    i = j;
  }
}
signed main() {
  fast_io();
  int n, m;
  cin >> n >> m;
  vector<Edge> edges(m);
  answer.resize(m, 3);
  for (int i = 0; i < m; ++i) {
    int u, v, w;
    cin >> u >> v >> w;
    edges[i] = Edge(u - 1, v - 1, w, i);
  }
  Tarjan(n, edges);
  for (int i : answer) {
    if (i == 1) {
      cout << "none\n";
    } else if (i == 2) {
      cout << "any\n";
    } else if (i == 3) {
      cout << "at least one\n";
    } else {
      cout << "PIZDA\n";
    }
  }
  return 0;
}
