#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(lint ngtkana_is_a_genius=0; ngtkana_is_a_genius<(lint)k; ngtkana_is_a_genius++)
using lint=long long;
using ld=long double;
template<class T> using numr=std::numeric_limits<T>;
struct input_t {
    template<class T> operator T() {
        T t;
        std::cin>>t;
        return t;
    }
} input;
#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/
// segtree {{{
/* APIs
 * - segtree(sz)
 * - size()
 * - fold(l, r)
 * - set(i, x)
 * - lazy_set(i, x)
 * - build()
 * - to_vec()
 */
template <class Monoid> struct segtree{/*{{{*/
    // a type alias
    using value_type = typename Monoid::value_type;

    // member variables
    std::vector<value_type>table;

    // trivial constructors
    segtree()=default;
    segtree(segtree const&)=default;
    segtree(segtree&&)=default;
    segtree&operator=(segtree const&)=default;
    segtree&operator=(segtree&&)=default;

    // a non-trivial constructor
    segtree(std::size_t n) : table(2*n, Monoid::id) {}

    // resize
    void resize(std::size_t n) {
        assert(table.empty());
        table.resize(2*n);
    }

    // size
    std::size_t size() const { return table.size() / 2; }

    // fold
    value_type fold(std::size_t l, std::size_t r) const {
        value_type fl = Monoid::id;
        value_type fr = Monoid::id;

        for(l+=size(),r+=size();l<r;l>>=1,r>>=1){
            if(l&1u) fl=Monoid::op(fl, table.at(l++));
            if(r&1u) fr=Monoid::op(fr, table.at(--r));
        }

        return Monoid::op(fl, fr);
    }

    // set
    void set(std::size_t i, value_type x) {
        assert(0 <= i);
        assert(i < size());

        i+=size();
        table.at(i) = x;

        for(i>>=1;i;i>>=1){ table.at(i) = Monoid::op(table.at(2*i), table.at(2*i+1)); }
    }

    // lazy_set
    void lazy_set(std::size_t i, value_type x) {
        assert(0 <= i);
        assert(i < size());

        i+=size();
        table.at(i) = x;
    }

    // map
    template <class F>
        void map(std::size_t i, F const& f) { set(i, f(at(i))); }

    // build
    void build() {
        for(std::size_t i=size()-1;i;i--){ table.at(i) = Monoid::op(table.at(2*i), table.at(2*i+1)); }
    }

    // at
    value_type at(std::size_t i) const { return table.at(size() + i); }

    // to_vec
    std::vector<value_type> to_vec() const {
        std::vector<value_type> ret(size());
        std::copy(table.begin()+size(), table.end(), ret.begin());
        return ret;
    }

};/*}}}*/
/*}}}*/
// add-monoid{{{
template <class Value> struct add_monoid_t {
    using value_type = Value;
    static value_type op(value_type l, value_type r) { return l + r; }
    static const value_type id;
};
template <class Value> const typename add_monoid_t<Value>::value_type
add_monoid_t<Value>::id = 0;
/*}}}*/

class hl_decomposition {

private:
    bool built = false;
    std::size_t time;

    void erase_prt_dfs(std::size_t x, std::size_t p)
    {
        auto&& v = g.at(x);
        auto p_found = std::find(v.begin(), v.end(), p);
        if (p_found!= v.end()) v.erase(p_found);
        for (std::size_t& y : v) {
            erase_prt_dfs(y, x);
        }
    }

    void size_dfs(std::size_t x)
    {
        auto&& v = g.at(x);
        for (std::size_t& y : v) {
            size_dfs(y);
            sz.at(x) += sz.at(y);
            if (sz.at(v.front()) < sz.at(y)) {
                std::swap(v.front(), y);
            }
        }
    }

    void head_dfs(std::size_t x)
    {
        vid.at(x) = time++;
        auto&& v = g.at(x);

        for (std::size_t y : v) {
            head.at(y) = y==v.front()
                ? head.at(x)
                : y
                ;
            head_dfs(y);
        }
    }

public:
    std::vector<std::size_t> sz, head, vid;
    std::vector<std::vector<std::size_t>> g;

    hl_decomposition()=default;
    hl_decomposition(hl_decomposition const&)=default;
    hl_decomposition(hl_decomposition&&)=default;
    hl_decomposition& operator=(hl_decomposition const&)=default;
    hl_decomposition& operator=(hl_decomposition&&)=default;
    ~hl_decomposition()=default;

    hl_decomposition(std::vector<std::vector<std::size_t>> const& g_, std::size_t root)
        : g(g_)
    {
        assert(root < size());
        build(root);
    }

    hl_decomposition(std::size_t n) : g(n) {}

    void insert(std::size_t u, std::size_t v) {
        assert(u < size() && v < size());
        g.at(u).push_back(v);
        // g.at(v).push_back(u);
    }

    void build(std::size_t root)
    {
        assert(!std::exchange(built, true));
        assert(root < size());

        time = 0;
        sz.assign(size(), 1u);
        head.resize(size());
        vid.resize(size());

        head.at(root) = root;

        erase_prt_dfs(root, root);
        size_dfs(root);
        head_dfs(root);
    }

    std::size_t size() const { return g.size(); }
};

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    std::size_t n;
    std::cin >> n;

    std::size_t root = 0;

    std::vector<std::size_t> prt(n);
    hl_decomposition hld(n);
    for (std::size_t i=0; i<n ;i++) {
        std::size_t k;
        std::cin >> k;
        while (k--) {
            std::size_t j;
            std::cin >> j;
            hld.insert(i, j);
            prt.at(j) = i;
        }
    }
    hld.build(0);

    std::size_t q;
    std::cin >> q;
    auto seg = segtree<add_monoid_t<unsigned long long>>(n);
    while (q--) {
        int c;
        std::cin >> c;

        if (c==0) {
            std::size_t u;
            unsigned long long w;
            std::cin >> u >> w;

            seg.set(hld.vid.at(u), seg.at(hld.vid.at(u)) + w);
        }

        if (c==1) {
            std::size_t u, v;
            std::cin >> u;
            v = root;

            unsigned long long ans = 0;

            while (u!=v) {
                if (hld.vid.at(u) > hld.vid.at(v)) {
                    std::swap(u, v);
                }
                if (hld.head.at(u) == hld.head.at(v)) {
                    ans += seg.fold(hld.vid.at(u)+1, hld.vid.at(v)+1);
                    break;
                }
                ans += seg.fold(hld.vid.at(hld.head.at(v)), hld.vid.at(v)+1);
                v = prt.at(hld.head.at(v));
            }

            std::cout << ans << '\n';
        }
    }
}





Measured memory_bytes: 17220