#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fo(i, a, b) for (int i = (a); i <= (b); ++i)
#define fd(i, a, b) for (int i = (a); i >= (b); --i)
#define ii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
const int N = 1e5+5;
struct Edge {
int u, v, c, id;
Edge(){}
Edge(int u_, int v_, int c_) {
u = u_, v = v_, c = c_;
}
bool operator < (const Edge &o) const {
return c < o.c;
}
};
int n, m, fa[N], h[N], up[N][17], mx[N][17], ans[N];
Edge e[N];
vector<ii> g[N];
vector<int> del[N];
bool inMst[N];
multiset<int> s[N];
set<ii> valid;
int find(int u) { return fa[u] == u ? u : fa[u] = find(fa[u]); }
bool merge(int u, int v) {
u = find(u), v = find(v);
if (u == v) return 0;
fa[u] = v; return 1;
}
void dfs(int u, int pre = -1) {
for (ii p : g[u]) if (p.fi != pre) {
int v = p.fi, c = p.se;
h[v] = h[u] + 1; up[v][0] = u, mx[v][0] = c;
fo(i, 1, 16) {
up[v][i] = up[up[v][i-1]][i-1];
mx[v][i] = max(mx[v][i-1], mx[up[v][i-1]][i-1]);
}
dfs(v, u);
}
}
ii get(int u, int v) {
int mm = 0;
if (h[u] != h[v]) {
if (h[u] < h[v]) swap(u, v);
int d = h[u] - h[v];
fo(i, 0, 16) if (d>>i&1) {
mm = max(mm, mx[u][i]);
u = up[u][i];
}
}
if (u == v) return {v, mm};
fd(i, 16, 0) if (up[u][i] != up[v][i]) {
mm = max({mm, mx[u][i], mx[v][i]});
u = up[u][i], v = up[v][i];
}
return {up[u][0], max({mm, mx[u][0], mx[v][0]})};
}
void dfs1(int u, int pre = -1) {
for (ii p : g[u]) if (p.fi != pre) {
int v = p.fi, c = p.se; dfs1(v, u);
if (s[v].empty() || c < (*s[v].begin())) {
valid.insert({u, v});
valid.insert({v, u});
}
if (s[u].size() < s[v].size()) swap(s[u], s[v]);
s[u].insert(all(s[v]));
}
for (int x : del[u]) s[u].erase(s[u].find(x));
}
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
if (fopen("A.inp", "r")) {
freopen("A.inp", "r", stdin);
// freopen("A.out", "w", stdout);
}
cin >> n >> m;
fo(i, 1, n) fa[i] = i;
fo(i, 1, m) cin >> e[i].u >> e[i].v >> e[i].c, e[i].id = i;
sort(e+1, e+m+1);
fo(i, 1, m) if (merge(e[i].v, e[i].u)) {
g[e[i].v].pb({e[i].u, e[i].c});
g[e[i].u].pb({e[i].v, e[i].c});
inMst[e[i].id] = ans[e[i].id] = 1;
}
dfs(1);
// 0 : none, 1 : at least one
fo(i, 1, m) {
int u = e[i].u, v = e[i].v, c = e[i].c;
if (get(u, v).se < c) ans[e[i].id] = 0;
else if (!inMst[e[i].id]) {
ans[e[i].id] = 1;
int lca = get(u, v).fi;
if (u != lca) {
s[u].insert(c);
del[lca].pb(c);
}
if (v != lca) {
s[v].insert(c);
del[lca].pb(c);
}
}
}
dfs1(1);
fo(i, 1, m) {
int u = e[i].u, v = e[i].v, c = e[i].c;
if (valid.count(ii(u, v)))
ans[e[i].id] = 2;
}
fo(i, 1, m) {
if (ans[i] == 0) cout << "none\n";
else if (ans[i] == 1) cout << "at least one\n";
else cout << "any\n";
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgZm8oaSwgYSwgYikgZm9yIChpbnQgaSA9IChhKTsgaSA8PSAoYik7ICsraSkKI2RlZmluZSBmZChpLCBhLCBiKSBmb3IgKGludCBpID0gKGEpOyBpID49IChiKTsgLS1pKQojZGVmaW5lIGlpIHBhaXI8aW50LCBpbnQ+CiNkZWZpbmUgZmkgZmlyc3QKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBwYiBwdXNoX2JhY2sKI2RlZmluZSBhbGwoeCkgeC5iZWdpbigpLCB4LmVuZCgpCmNvbnN0IGludCBOID0gMWU1KzU7CgpzdHJ1Y3QgRWRnZSB7CiAg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uZmluZCh4KSk7Cn0KCmludDMyX3QgbWFpbigpIHsKICAgIGNpbi50aWUoMCktPnN5bmNfd2l0aF9zdGRpbygwKTsKICAgIGlmIChmb3BlbigiQS5pbnAiLCAiciIpKSB7CiAgICAgICAgZnJlb3BlbigiQS5pbnAiLCAiciIsIHN0ZGluKTsKLy8gICAgICAgIGZyZW9wZW4oIkEub3V0IiwgInciLCBzdGRvdXQpOwogICAgfQogICAgY2luID4+IG4gPj4gbTsKICAgIGZvKGksIDEsIG4pIGZhW2ldID0gaTsKICAgIGZvKGksIDEsIG0pIGNpbiA+PiBlW2ldLnUgPj4gZVtpXS52ID4+IGVbaV0uYywgZVtpXS5pZCA9IGk7CiAgICBzb3J0KGUrMSwgZSttKzEpOwogICAgZm8oaSwgMSwgbSkgaWYgKG1lcmdlKGVbaV0udiwgZVtpXS51KSkgewogICAgICAgIGdbZVtpXS52XS5wYih7ZVtpXS51LCBlW2ldLmN9KTsKICAgICAgICBnW2VbaV0udV0ucGIoe2VbaV0udiwgZVtpXS5jfSk7CiAgICAgICAgaW5Nc3RbZVtpXS5pZF0gPSBhbnNbZVtpXS5pZF0gPSAxOwogICAgfQogICAgZGZzKDEpOwogICAgLy8gMCA6IG5vbmUsIDEgOiBhdCBsZWFzdCBvbmUKICAgIGZvKGksIDEsIG0pIHsKICAgICAgICBpbnQgdSA9IGVbaV0udSwgdiA9IGVbaV0udiwgYyA9IGVbaV0uYzsKICAgICAgICBpZiAoZ2V0KHUsIHYpLnNlIDwgYykgYW5zW2VbaV0uaWRdID0gMDsKICAgICAgICBlbHNlIGlmICghaW5Nc3RbZVtpXS5pZF0pIHsKICAgICAgICAgICAgYW5zW2VbaV0uaWRdID0gMTsKICAgICAgICAgICAgaW50IGxjYSA9IGdldCh1LCB2KS5maTsKICAgICAgICAgICAgaWYgKHUgIT0gbGNhKSB7CiAgICAgICAgICAgICAgICBzW3VdLmluc2VydChjKTsKICAgICAgICAgICAgICAgIGRlbFtsY2FdLnBiKGMpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh2ICE9IGxjYSkgewogICAgICAgICAgICAgICAgc1t2XS5pbnNlcnQoYyk7CiAgICAgICAgICAgICAgICBkZWxbbGNhXS5wYihjKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIGRmczEoMSk7CiAgICBmbyhpLCAxLCBtKSB7CiAgICAgICAgaW50IHUgPSBlW2ldLnUsIHYgPSBlW2ldLnYsIGMgPSBlW2ldLmM7CiAgICAgICAgaWYgKHZhbGlkLmNvdW50KGlpKHUsIHYpKSkKICAgICAgICAgICAgYW5zW2VbaV0uaWRdID0gMjsKICAgIH0KICAgIGZvKGksIDEsIG0pIHsKICAgICAgICBpZiAoYW5zW2ldID09IDApIGNvdXQgPDwgIm5vbmVcbiI7CiAgICAgICAgZWxzZSBpZiAoYW5zW2ldID09IDEpIGNvdXQgPDwgImF0IGxlYXN0IG9uZVxuIjsKICAgICAgICBlbHNlIGNvdXQgPDwgImFueVxuIjsKICAgIH0KfQo=