#include <bits/stdc++.h>
using namespace std;
inline int gi() {
  char c = getchar();
  int x = 0;
  for (; c < '0' || c > '9'; c = getchar())
    ;
  for (; c >= '0' && c <= '9'; c = getchar()) x = (x << 1) + (x << 3) + c - '0';
  return x;
}
const int N = 2e5 + 5, Mod = 998244353;
vector<int> e[N];
int size[N], fa[N], son[N], top[N], dep[N], st[N], ed[N], tim, n, q, in, t[N],
    tag[N], all;
inline void add(int& x, int y) { x = (x + y >= Mod ? x + y - Mod : x + y); }
inline int po(int x, int y = Mod - 2) {
  int r = 1;
  while (y) {
    if (y & 1) r = (1ll * (r) * (x) % Mod);
    x = (1ll * (x) * (x) % Mod), y >>= 1;
  }
  return r;
}
void dfs1(int u) {
  size[u] = 1;
  dep[u] = dep[fa[u]] + 1;
  for (auto v : e[u])
    if (v != fa[u]) {
      fa[v] = u, dfs1(v);
      size[u] += size[v];
      if (size[v] > size[son[u]]) son[u] = v;
    }
}
void dfs2(int u, int tp) {
  top[u] = tp, st[u] = ++tim;
  if (son[u]) dfs2(son[u], tp);
  for (auto v : e[u])
    if (v != fa[u] && v != son[u]) dfs2(v, v);
  ed[u] = tim;
}
void upd(int i, int w) {
  for (; i <= n; i += (i & -i)) add(t[i], w);
}
int qry(int i) {
  int r = 0;
  for (; i; i -= (i & -i)) add(r, t[i]);
  return r;
}
int main() {
  n = gi(), q = gi(), in = po(n);
  for (int i = 1; i < n; ++i) {
    int u = gi(), v = gi();
    e[u].push_back(v);
    e[v].push_back(u);
  }
  dfs1(1), dfs2(1, 1);
  while (q--) {
    int op = gi(), u = gi();
    if (op == 1) {
      int d = (1ll * (in) * (gi()) % Mod);
      add(all, (1ll * (size[u]) * (d) % Mod));
      add(tag[u], Mod - d);
      int tmp = (1ll * (n - size[u]) * (d) % Mod);
      upd(st[u], tmp), upd(ed[u] + 1, Mod - tmp);
      if (son[u]) {
        tmp = (1ll * (size[son[u]]) * (Mod - d) % Mod);
        upd(st[son[u]], tmp), upd(ed[son[u]] + 1, Mod - tmp);
      }
    } else {
      int ans = qry(st[u]);
      add(ans, all);
      for (; fa[top[u]]; u = fa[top[u]])
        add(ans, (1ll * (size[top[u]]) * (tag[fa[top[u]]]) % Mod));
      printf("%d\n", ans);
    }
  }
}
