#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 998244353, maxn = 1e5 + 5e4 + 5;
void add(int& x, int y) {
  x += y;
  if (x >= mod) x -= mod;
  if (x < 0) x += mod;
}
int power(int a, int b) {
  if (b == 0) return 1;
  int res = power(a, b / 2);
  if (b & 1) return 1ll * res * res % mod * a % mod;
  return 1ll * res * res % mod;
}
int inv(int a) { return power(a, mod - 2); }
class BIT {
 public:
  int bit[maxn];
  void upd(int i, int val) {
    for (; i < maxn; i += i & -i) add(bit[i], val);
  }
  int query(int i) {
    int res = 0;
    for (; i; i -= i & -i) add(res, bit[i]);
    return res;
  }
  void upd(int l, int r, ll val) {
    upd(l, val);
    upd(r + 1, -val);
  }
} ft;
int N, Q;
vector<int> adj[maxn];
int tin[maxn], tout[maxn], lazy[maxn], sz[maxn];
vector<int> big;
void dfs(int u, int p = -1) {
  static int nTime = 0;
  tin[u] = ++nTime;
  sz[u] = 1;
  if (p != -1) {
    auto it = find(adj[u].begin(), adj[u].end(), p);
    adj[u].erase(it);
  }
  for (int v : adj[u]) {
    dfs(v, u);
    sz[u] += sz[v];
  }
  tout[u] = nTime;
}
bool isAnc(int u, int v) { return tin[u] <= tin[v] && tout[v] <= tout[u]; }
int child(int u, int v) {
  int l = 0, r = adj[u].size() - 1, mid;
  while (l <= r) {
    mid = (l + r) / 2;
    int a = adj[u][mid];
    if (tin[a] <= tin[v])
      l = mid + 1;
    else
      r = mid - 1;
  }
  return adj[u][r];
}
signed main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> Q;
  for (int i = 1; i < N; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].emplace_back(v);
    adj[v].emplace_back(u);
  }
  dfs(1);
  int magic = sqrt(N);
  for (int i = 1; i <= N; ++i) {
    if (adj[i].size() > magic) {
      big.emplace_back(i);
    }
  }
  for (int i = 1; i <= Q; ++i) {
    int type, v;
    cin >> type >> v;
    if (type == 1) {
      int val;
      cin >> val;
      if (adj[v].size() > magic) {
        add(lazy[v], val);
      } else {
        for (int c : adj[v]) {
          ft.upd(tin[c], tout[c], 1ll * (N - sz[c]) * val % mod);
        }
        ll req = 1ll * sz[v] * val % mod;
        if (tin[v] > 1) ft.upd(1, tin[v] - 1, req);
        if (tout[v] < N) ft.upd(tout[v] + 1, N, req);
        ft.upd(tin[v], tin[v], (ll)val * N % mod);
      }
    } else {
      int res = ft.query(tin[v]);
      if (adj[v].size() > magic) add(res, 1ll * lazy[v] * N % mod);
      for (int u : big) {
        if (u == v) continue;
        if (isAnc(u, v)) {
          add(res, (ll)lazy[u] * (N - sz[child(u, v)]) % mod);
        } else {
          add(res, (ll)lazy[u] * sz[u] % mod);
        }
      }
      res = (ll)res * inv(N) % mod;
      cout << res << '\n';
    }
  }
}
