Problem: Write a program which manipulates a weighted rooted tree $T$ with the following operations:

* $add(v,w)$: add $w$ to the edge which connects node $v$ and its parent

* $getSum(u)$: report the sum of weights of all edges from the root to node $u$



The given tree $T$ consists of $n$ nodes and every node has a unique ID from $0$ to $n-1$ respectively where ID of the root is $0$. Note that all weights are initialized to zero.

Constraints

* All the inputs are given in integers
* $ 2 \leq n \leq 100000 $
* $ c_j < c_{j+1} $   $( 1 \leq j \leq k-1 )$
* $ 2 \leq q \leq 200000 $
* $ 1 \leq u,v \leq n-1 $
* $ 1 \leq w \leq 10000 $

Input

The input is given in the following format.

$n$
$node_0$
$node_1$
$node_2$
$:$
$node_{n-1}$
$q$
$query_1$
$query_2$
$:$
$query_{q}$


The first line of the input includes an integer $n$, the number of nodes in the tree.

In the next $n$ lines,the information of node $i$ is given in the following format:


ki c1 c2 ... ck


$k_i$ is the number of children of node $i$, and $c_1$ $c_2$ ... $c_{k_i}$ are node IDs of 1st, ... $k$th child of node $i$.

In the next line, the number of queries $q$ is given. In the next $q$ lines, $i$th query is given in the following format:


0 v w


or


1 u


The first integer represents the type of queries.'0' denotes $add(v, w)$ and '1' denotes $getSum(u)$.

Output

For each $getSum$ query, print the sum in a line.

Examples

Input

6
2 1 2
2 3 5
0
0
0
1 4
7
1 1
0 3 10
1 2
0 4 20
1 3
0 5 40
1 4


Output

0
0
10
60


Input

4
1 1
1 2
1 3
0
6
0 3 1000
0 2 1000
0 1 1000
1 1
1 2
1 3


Output

1000
2000
3000


Input

2
1 1
0
4
0 1 1
1 1
0 1 1
1 1


Output

1
2

Solution (in CPP):

Solution:
#include <iostream>
#include <cassert>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) std::cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<std::endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}

template<typename T>
class Deque{
public:
  T *val;
  int sz;
  int length;
  int head, tail;
  
  Deque(){sz = 0, length = 0, val = new T[0];}
  Deque(int size, T init = T()){
    length = 1;
    while(length < size) length *= 2;
    val = new T[length];
    sz = size;
    head = 0;
    tail = 0;
    for(int i=0;i<size;i++) val[tail++] = init;
  }
  
  Deque(const Deque &t){
    sz = t.size();
    length = 1;
    while(length < sz) length *= 2;
    val = new T[length];
    head = 0;
    tail = 0;
    for(int i=0;i<sz;i++) val[tail++] = t[i];
  }

  ~Deque(){
    delete [] val;
  }
  
  Deque<T> operator = (const Deque<T> t){
    delete [] val;
    sz = t.size();
    length = 1;
    while(length < sz) length *= 2;
    val = new T[length];
    head = 0;
    tail = 0;
    for(int i=0;i<sz;i++) val[tail++] = t[i];
    return t;
  };
  
  T& operator [] (int i){
    assert(0 <= i && i < sz);
    return head+i<length? val[head+i]:val[head+i - length];
  }
  T& operator [] (int i)const{
   assert(0 <= i && i < sz);
    return head+i<length? val[head+i]:val[head+i - length];
  }
  
  bool operator == (const Deque<T> &a)const{
    if(size() != a.size()) return 0;
    for(int i=0;i<size();i++)
      if(!((*this)[i] == a[i])) return 0;
    return 1;
  }
  
  T& front(){return val[head];}
  T& back(){return val[(head + sz - 1) % length];}
  
  int size()const{return sz;}
  int empty()const{return sz == 0;}
  
  void resize(int n, T v=T()){
    while(n < size()) pop_back();
    while(n > size()) push_back_fast(v);
  }


  void increaseMemory(){
    int length_ = length;
    length = length * 2;
    if(length == 0) length = 1;
    T *val2 = new T[length];
    for(int i=0;i<sz;i++) val2[i] = val[(head + i)%length_];
    head = 0;
    tail = sz;
    delete [] val;
    val = val2;
  };
  
  void push_back(T v){
    if(sz == length) increaseMemory();
    sz++;
    val[tail++] = v;
    if(tail == length) tail = 0;
  }

  void push_back_fast(T &v){
    if(sz == length) increaseMemory();
    sz++;
    val[tail++] = v;
    if(tail == length) tail = 0;
  }
    
  void push_front(int v){
    if(sz == length) increaseMemory();
    sz++;
    head--;
    if(head == -1) head = length - 1;
    val[head] = v;
  }

  void pop_back(){
    assert(sz > 0);
    sz--;
    tail--;
    if(tail == -1) tail = length - 1;
  }
  
  void pop_front(){
    assert(sz > 0);
    sz--;
    head++;
    if(head == length) head = 0;
  }

  friend std::ostream& operator << (std::ostream& os,const Deque<T> a){
    os<<"[";
    for(int i=0;i<a.size();i++){
      if(i) os<<" ";
      os<<a[i];
    }
    os<<"]";
    return os;
  }
};

template <typename T>
using vector = Deque<T>;

template <typename T, typename D>
class Pair{
public:
  T first;
  D second;
  Pair(){first = T(),second = D();}
  Pair(const T first, const D second):first(first), second(second){}
  
  bool operator < (const Pair t)const{
    return first != t.first? (first < t.first):(second < t.second);
  }
  bool operator > (const Pair t)const{
    return first != t.first? (first > t.first):(second > t.second);
  }
  
  friend std::ostream& operator << (std::ostream& os,const Pair<T, D> a){
    os<<"("<<a.first<<", "<<a.second<<")";
    return os;
  }
};

template <typename T, typename D> using pair = Pair<T,D>;

class EulerTour{
public:
  int V;                     //ノード数
  int root;                  //根の頂点番号
  vector<vector<int> > G;    //Grapth
  vector<int> L,R;           //[L,R]
  bool ok;
  EulerTour():V(-1),ok(0){};
  EulerTour(int V,int root = 0):V(V),root(root),G(V),L(V),R(V),ok(0){}

  void add_edge(int a,int b){
    assert(a >= 0 && b >= 0);
    assert(a < V && b < V);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  void dfs(int pos,int pre, int &cnt){
    L[pos] = cnt;
    for(int i=0;i<G[pos].size();i++){
      int to = G[pos][i];
      if(to != pre) cnt++, dfs(to, pos, cnt);
    }
    R[pos] = cnt;
  };
  
  void build(){
    ok = 1;
    int cnt = 0;
    dfs(root, -1, cnt);
  }
  
  typedef pair<int,int> P;
  P get(int v){assert(ok && v < V); return P(L[v],R[v]);} //[l, r]
};

class RSAQ{
public: 
  typedef long long ll;

  //マージ可能な主データ型
  struct D{
    ll value;
    D():value(0){} /*適切な値にする!!!!!!*/
    D(ll value):value(value){}
    bool operator < (D a)const {return value < a.value;}
  };

  //遅延用の型  
  struct T{
    int type; //0 - empty   , 1 - update
    ll value;
    T():type(0),value(0){}
    T(int type,ll value):type(type),value(value){}
  };

  
  int n, n_;
  vector<D> dat;
  vector<T> td;
  D returnD = D(0); // 範囲外の時に返す値。
  
  RSAQ(){n=-1;}
  RSAQ(int n_):n_(n_){
    n=1;
    while(n < n_) n *= 2;
    td.resize(2*n-1,T());
    dat.resize(2*n-1,D());
  }
  
  inline D merge(const D a,const D b)const{return a.value + b.value;}
  
  void delay(int k,int len){
    if(td[k].type==0) return;
    ll type = td[k].type;
    ll v = td[k].value;
    td[k].type = 0;
    td[k].value = 0;
    len /= 2;
    {
      int l = k*2+1;
      dat[l].value += v * len;
      td[l].type = type;
      td[l].value += v;
    }
    {
      int r = k*2+2;
      dat[r].value += v * len;
      td[r].type = type;
      td[r].value += v;
    }
  }

  D write(int k, D x, int len){
    dat[k].value += x.value * len;
    td[k].type = 1;
    td[k].value += x.value;
    return dat[k];
  }
  
  D dfs(int a, int b, D x, bool flag, int k, int l, int r){
    if(r <= a||b <= l) return flag? dat[k]:returnD;
    if(a <= l && r <= b) return flag? write(k, x, r - l):dat[k];
    delay(k, r - l);
    D vl = dfs(a, b, x, flag, k*2+1, l, (l+r)/2);
    D vr = dfs(a, b, x, flag, k*2+2, (l+r)/2, r);
    return flag? (dat[k] = merge(vl, vr)):merge(vl, vr);
  }

  //[l,r)の値にx加算
  void add(int l,int r,ll x){
    assert(l <= r);
    assert(0 <= l && l <= n);
    assert(0 <= r && r <= n);
    dfs(l, r, D(x), true, 0, 0, n);
  }
  
  //[l,r)の合計値を得る
  ll get(int l,int r){
    assert(l <= r);
    assert(0 <= l && l <= n);
    assert(0 <= r && r <= n);
    D res = dfs(l, r, D(), false, 0, 0, n);
    return res.value;
  }
};


signed main(){


  int N;
  std::cin>>N;

  EulerTour ET(N, 0);
  
  for(int i=0;i<N;i++){
    int k;
    std::cin>>k;
    for(int j=0;j<k;j++){
      int c;
      std::cin>>c;
      ET.add_edge(i, c);
    }
  }
  
  
  ET.build();
  
  RSAQ seg(N);
  auto add =[&](int v, int w){
    auto p = ET.get(v);
    seg.add(p.first, p.second + 1, w);
  };

  auto getSum=[&](int u){
    int idx = ET.get(u).first;
    return seg.get(idx, idx+1);
  };

  int q;
  std::cin>>q;
  while(q--){
    int cmd;
    std::cin>>cmd;
    if(cmd == 0){
      int v, w;
      std::cin>>v>>w;
      add(v, w);
    }
    else{
      int u;
      std::cin>>u;
      int ans = getSum(u);
      std::cout<<ans<<std::endl;
    }
  }
  return 0;
}