Problem: 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>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmin(T &a, T b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline T read() {
  register T _, __;
  register char c_;
  for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar())
    if (c_ == '-') __ = -1;
  for (; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ * 10) + (c_ ^ 48);
  return _ * __;
}
const int MAXN1 = 1e5 + 5, MAXN2 = 2e5 + 5;
int n, m, q, w[MAXN1];
vector<int> T1[MAXN1], T2[MAXN2];
void add1(int u, int v) { T1[u].push_back(v), T1[v].push_back(u); }
void add2(int u, int v) { T2[u].push_back(v), T2[v].push_back(u); }
int dfn[MAXN2], low[MAXN2], stk[MAXN1], tp, clk;
int tot;
void Tarjan(int u, int pa) {
  dfn[u] = low[u] = ++clk;
  stk[++tp] = u;
  for (int v : T1[u]) {
    if (!dfn[v]) {
      Tarjan(v, u);
      chkmin(low[u], low[v]);
      if (low[v] >= dfn[u]) {
        add2(++tot, u);
        do add2(tot, stk[tp]);
        while (stk[tp--] != v);
      }
    } else if (v != pa)
      chkmin(low[u], dfn[v]);
  }
}
int sz[MAXN2], fa[MAXN2], dep[MAXN2], top[MAXN2], id[MAXN2], son[MAXN2];
void DFS1(int u, int pa) {
  sz[u] = 1, fa[u] = pa;
  dep[u] = dep[pa] + 1;
  for (int v : T2[u])
    if (v != pa) {
      DFS1(v, u);
      sz[u] += sz[v];
      if (sz[son[u]] < sz[v]) son[u] = v;
    }
}
void DFS2(int u, int pa) {
  dfn[u] = ++clk, id[clk] = u;
  if (son[u]) top[son[u]] = top[u], DFS2(son[u], u);
  for (int v : T2[u])
    if (v != pa && v != son[u]) DFS2(top[v] = v, u);
}
multiset<int> Set[MAXN1];
namespace SMT {
int mn[MAXN2 << 2];
void maintain(int t) { mn[t] = min(mn[(t << 1)], mn[((t << 1) | 1)]); }
void build(int t, int l, int r) {
  if (l == r) {
    mn[t] = id[l] <= n ? w[id[l]] : *Set[id[l] - n].begin();
    return;
  }
  build((t << 1), l, ((l + r) >> 1)),
      build(((t << 1) | 1), ((l + r) >> 1) + 1, r);
  maintain(t);
}
void update(int t, int l, int r, int x) {
  if (l == r) {
    mn[t] = id[l] <= n ? w[id[l]] : *Set[id[l] - n].begin();
    return;
  }
  if (x <= ((l + r) >> 1))
    update((t << 1), l, ((l + r) >> 1), x);
  else
    update(((t << 1) | 1), ((l + r) >> 1) + 1, r, x);
  maintain(t);
}
int query(int t, int l, int r, int x, int y) {
  if (x <= l && r <= y) return mn[t];
  if (y <= ((l + r) >> 1)) return query((t << 1), l, ((l + r) >> 1), x, y);
  if (x > ((l + r) >> 1))
    return query(((t << 1) | 1), ((l + r) >> 1) + 1, r, x, y);
  return min(query((t << 1), l, ((l + r) >> 1), x, y),
             query(((t << 1) | 1), ((l + r) >> 1) + 1, r, x, y));
}
}  // namespace SMT
int query(int u, int v) {
  int ans = (0x3f3f3f3f);
  while (top[u] != top[v]) {
    if (dep[top[u]] < dep[top[v]]) swap(u, v);
    chkmin(ans, SMT::query(1, 1, tot, dfn[top[u]], dfn[u]));
    u = fa[top[u]];
  }
  if (dep[u] > dep[v]) swap(u, v);
  chkmin(ans, SMT::query(1, 1, tot, dfn[u], dfn[v]));
  if (u > n) chkmin(ans, w[fa[u]]);
  return ans;
}
int main() {
  n = read<int>(), m = read<int>(), q = read<int>();
  for (register int i = (1), i_end_ = (n); i <= i_end_; ++i) w[i] = read<int>();
  for (register int i = (1), i_end_ = (m); i <= i_end_; ++i)
    add1(read<int>(), read<int>());
  tot = n;
  Tarjan(1, 0);
  DFS1(1, 0);
  clk = 0, DFS2(top[1] = 1, 0);
  for (register int u = (n + 1), u_end_ = (tot); u <= u_end_; ++u)
    for (int v : T2[u])
      if (v != fa[u]) Set[u - n].insert(w[v]);
  assert(tot == clk);
  SMT::build(1, 1, tot);
  while (q--) {
    static char opt[4];
    scanf("%s", opt);
    if (opt[0] == 'C') {
      int u = read<int>(), dt = read<int>();
      if (fa[u]) {
        Set[fa[u] - n].erase(Set[fa[u] - n].find(w[u]));
        Set[fa[u] - n].insert(dt);
      }
      w[u] = dt;
      SMT::update(1, 1, tot, dfn[u]);
      if (fa[u]) SMT::update(1, 1, tot, dfn[fa[u]]);
    } else
      printf("%d\n", query(read<int>(), read<int>()));
  }
  return 0;
}