There are n cities in Cyberland, numbered from 1 to n, connected by m bidirectional roads. The j-th road connects city aj and bj.

For tourists, souvenirs are sold in every city of Cyberland. In particular, city i sell it at a price of wi.

Now there are q queries for you to handle. There are two types of queries:

  * "C a w": The price in city a is changed to w.
  * "A a b": Now a tourist will travel from city a to b. He will choose a route, he also doesn't want to visit a city twice. He will buy souvenirs at the city where the souvenirs are the cheapest (possibly exactly at city a or b). You should output the minimum possible price that he can buy the souvenirs during his travel.



More formally, we can define routes as follow:

  * A route is a sequence of cities [x1, x2, ..., xk], where k is a certain positive integer.
  * For any 1 ≤ i < j ≤ k, xi ≠ xj.
  * For any 1 ≤ i < k, there is a road connecting xi and xi + 1.
  * The minimum price of the route is min(wx1, wx2, ..., wxk).
  * The required answer is the minimum value of the minimum prices of all valid routes from a to b.

Input

The first line of input contains three integers n, m, q (1 ≤ n, m, q ≤ 105), separated by a single space.

Next n lines contain integers wi (1 ≤ wi ≤ 109).

Next m lines contain pairs of space-separated integers aj and bj (1 ≤ aj, bj ≤ n, aj ≠ bj).

It is guaranteed that there is at most one road connecting the same pair of cities. There is always at least one valid route between any two cities.

Next q lines each describe a query. The format is "C a w" or "A a b" (1 ≤ a, b ≤ n, 1 ≤ w ≤ 109).

Output

For each query of type "A", output the corresponding answer.

Examples

Input

3 3 3
1
2
3
1 2
2 3
1 3
A 2 3
C 1 5
A 2 3


Output

1
2


Input

7 9 4
1
2
3
4
5
6
7
1 2
2 5
1 5
2 3
3 4
2 4
5 6
6 7
5 7
A 2 3
A 6 4
A 6 7
A 3 3


Output

2
1
5
3

Note

For the second sample, an optimal routes are:

From 2 to 3 it is [2, 3].

From 6 to 4 it is [6, 5, 1, 2, 4].

From 6 to 7 it is [6, 5, 7].

From 3 to 3 it is [3].

<image>
#include <bits/stdc++.h>
const int kN = 2e5 + 10;
const int kInf = 1e9 + 2077;
int n, m, q, e_num, val[kN], head[kN], v[kN << 1], ne[kN << 1];
int dfnnum, cnt, dfn[kN], low[kN];
int hld_dfnnum, hld_dfn[kN], s[kN];
int fa[kN];
std::vector<int> newv[kN];
std::stack<int> st;
std::multiset<int> minval[kN];
inline int read() {
  int f = 1, w = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) w = (w << 3) + (w << 1) + (ch ^ '0');
  return f * w;
}
void Chkmax(int &fir, int sec) {
  if (sec > fir) fir = sec;
}
void Chkmin(int &fir, int sec) {
  if (sec < fir) fir = sec;
}
void Add(int u_, int v_) {
  v[++e_num] = v_, ne[e_num] = head[u_], head[u_] = e_num;
}
void Tarjan(int u_) {
  dfn[u_] = low[u_] = ++dfnnum;
  st.push(u_);
  for (int i = head[u_]; i; i = ne[i]) {
    int v_ = v[i];
    if (!dfn[v_]) {
      Tarjan(v_);
      Chkmin(low[u_], low[v_]);
      if (low[v_] >= dfn[u_]) {
        ++cnt;
        newv[cnt].push_back(u_), newv[u_].push_back(cnt);
        while (true) {
          int top_ = st.top();
          newv[cnt].push_back(top_), newv[top_].push_back(cnt);
          st.pop();
          if (top_ == v_) break;
        }
      }
    } else {
      Chkmin(low[u_], dfn[v_]);
    }
  }
}
namespace Seg {
int minv[kN << 2];
void Pushup(int now_) {
  minv[now_] = std::min(minv[(now_ << 1)], minv[(now_ << 1 | 1)]);
}
void Build(int now_, int L_, int R_) {
  if (L_ == R_) {
    minv[now_] = val[s[L_]];
    return;
  }
  Build((now_ << 1), L_, ((L_ + R_) >> 1)),
      Build((now_ << 1 | 1), ((L_ + R_) >> 1) + 1, R_);
  Pushup(now_);
}
void Modify(int now_, int L_, int R_, int pos_, int val_) {
  if (L_ == R_) {
    minv[now_] = val_;
    return;
  }
  if (pos_ <= ((L_ + R_) >> 1))
    Modify((now_ << 1), L_, ((L_ + R_) >> 1), pos_, val_);
  else
    Modify((now_ << 1 | 1), ((L_ + R_) >> 1) + 1, R_, pos_, val_);
  Pushup(now_);
}
int Query(int now_, int L_, int R_, int l_, int r_) {
  if (l_ <= L_ && R_ <= r_) return minv[now_];
  int ret = kInf;
  if (l_ <= ((L_ + R_) >> 1))
    Chkmin(ret, Query((now_ << 1), L_, ((L_ + R_) >> 1), l_, r_));
  if (r_ > ((L_ + R_) >> 1))
    Chkmin(ret, Query((now_ << 1 | 1), ((L_ + R_) >> 1) + 1, R_, l_, r_));
  return ret;
}
}  // namespace Seg
namespace HLD {
int son[kN], dep[kN], sz[kN], top[kN];
void Dfs1(int u_, int fa_) {
  fa[u_] = fa_;
  sz[u_] = 1;
  dep[u_] = dep[fa_] + 1;
  for (int i = 0, lim = newv[u_].size(); i < lim; ++i) {
    int v_ = newv[u_][i];
    if (v_ == fa_) continue;
    Dfs1(v_, u_);
    if (sz[v_] > sz[son[u_]]) son[u_] = v_;
    sz[u_] += sz[v_];
    if (u_ > n) minval[u_].insert(val[v_]);
  }
  if (u_ > n) val[u_] = *minval[u_].begin();
}
void Dfs2(int u_, int top_) {
  hld_dfn[u_] = ++hld_dfnnum;
  s[hld_dfnnum] = u_;
  top[u_] = top_;
  if (son[u_]) Dfs2(son[u_], top_);
  for (int i = 0, lim = newv[u_].size(); i < lim; ++i) {
    int v_ = newv[u_][i];
    if (v_ == fa[u_] || v_ == son[u_]) continue;
    Dfs2(v_, v_);
  }
}
int Query(int u_, int v_) {
  int ret = kInf;
  for (; top[u_] != top[v_]; u_ = fa[top[u_]]) {
    if (dep[top[u_]] < dep[top[v_]]) {
      std::swap(u_, v_);
    }
    Chkmin(ret, Seg::Query(1, 1, cnt, hld_dfn[top[u_]], hld_dfn[u_]));
  }
  int lca = dep[u_] < dep[v_] ? u_ : v_;
  if (lca != v_) std::swap(u_, v_);
  Chkmin(ret, Seg::Query(1, 1, cnt, hld_dfn[lca], hld_dfn[u_]));
  if (lca > n) Chkmin(ret, val[fa[lca]]);
  return ret;
}
}  // namespace HLD
void Modify(int u_, int val_) {
  int f = fa[u_];
  if (f) minval[f].erase(val[u_]);
  Seg::Modify(1, 1, cnt, hld_dfn[u_], val[u_] = val_);
  if (f) {
    minval[f].insert(val[u_]);
    Seg::Modify(1, 1, cnt, hld_dfn[f], val[f] = *minval[f].begin());
  }
}
int Query(int u_, int v_) { return HLD::Query(u_, v_); }
int main() {
  cnt = n = read(), m = read(), q = read();
  for (int i = 1; i <= n; ++i) val[i] = read();
  for (int i = 1; i <= m; ++i) {
    int u_ = read(), v_ = read();
    Add(u_, v_), Add(v_, u_);
  }
  for (int i = 1; i <= n; ++i) {
    if (!dfn[i]) {
      Tarjan(i);
    }
  }
  HLD::Dfs1(1, 0), HLD::Dfs2(1, 1);
  Seg::Build(1, 1, cnt);
  for (int i = 1; i <= q; ++i) {
    char opt[5];
    scanf("%s", opt);
    if (opt[0] == 'C') {
      int pos_ = read(), val_ = read();
      Modify(pos_, val_);
    } else {
      int u_ = read(), v_ = read();
      printf("%d\n", Query(u_, v_));
    }
  }
  return 0;
}
