#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 3;
vector<int> inq[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  vector<vector<int>> edge(n + 1);
  vector<tuple<int, int, int>> edges;
  for (int i = 0; i < m; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    edges.emplace_back(u, v, w);
    edge[u].emplace_back(i);
  }
  priority_queue<pair<long long, int>> pq;
  const long long inf = 1e18;
  vector<long long> d(n + 1, inf);
  d[1] = 0;
  pq.emplace(d[1], 1);
  while ((int)pq.size()) {
    auto x = pq.top();
    pq.pop();
    if (-x.first != d[x.second]) continue;
    int v = x.second;
    for (auto& x : edge[v]) {
      int u = get<1>(edges[x]);
      if (d[u] > d[v] + get<2>(edges[x])) {
        d[u] = d[v] + get<2>(edges[x]);
        pq.emplace(-d[u], u);
      }
    }
  }
  vector<int> add(m);
  for (int i = 0; i < m; i++) {
    auto& x = edges[i];
    add[i] = get<2>(x) - (d[get<1>(x)] - d[get<0>(x)]);
  }
  int up = 0;
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      int v;
      cin >> v;
      if (up) {
        vector<int> dist(n + 1, (int)1e9);
        dist[1] = 0;
        inq[0].emplace_back(1);
        for (int i = 0; i <= up; i++) {
          while ((int)inq[i].size()) {
            int v = inq[i].back();
            inq[i].pop_back();
            if (dist[v] != i) continue;
            for (auto& x : edge[v]) {
              int u = get<1>(edges[x]);
              if (dist[u] > dist[v] + add[x]) {
                dist[u] = dist[v] + add[x];
                if (dist[u] <= up) inq[dist[u]].emplace_back(u);
              }
            }
          }
        }
        for (int i = 1; i <= n; i++) d[i] = min(d[i] + dist[i], inf);
        for (int i = 0; i < m; i++) {
          auto& x = edges[i];
          add[i] -= (dist[get<1>(x)] - dist[get<0>(x)]);
        }
        up = 0;
      }
      if (d[v] != inf)
        cout << d[v] << "\n";
      else
        cout << "-1\n";
    } else {
      int foo;
      cin >> foo;
      for (int i = 0; i < foo; i++) {
        int x;
        cin >> x;
        --x;
        add[x]++;
      }
      up += foo;
    }
  }
}
