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>
using namespace std;
const int N = 200000 + 5;
vector<int> e[N], g[N];
int low[N], dfn[N], tot, ccnt;
stack<int> S;
void tarjan(int x) {
  low[x] = dfn[x] = ++tot;
  S.push(x);
  for (int i = 0; i < e[x].size(); ++i)
    if (!dfn[e[x][i]]) {
      int v = e[x][i];
      tarjan(v);
      if (low[v] == dfn[x]) {
        ++ccnt;
        g[x].push_back(ccnt);
        g[ccnt].push_back(x);
        while (1) {
          int now = S.top();
          S.pop();
          g[now].push_back(ccnt);
          g[ccnt].push_back(now);
          if (now == v) break;
        }
      }
      low[x] = min(low[x], low[v]);
    } else
      low[x] = min(low[x], dfn[e[x][i]]);
}
int n, cnt, fa[N], id[N], sz[N], son[N], con[N], val[N], top[N], dep[N];
multiset<int> dis[N];
void dfs1(int x, int fath) {
  fa[x] = fath;
  sz[x] = 1;
  dep[x] = dep[fath] + 1;
  for (int i = 0; i < g[x].size(); ++i)
    if (g[x][i] != fath) {
      int v = g[x][i];
      dfs1(v, x);
      sz[x] += sz[v];
      if (sz[son[x]] < sz[v]) son[x] = v;
    }
}
void dfs2(int x, int tp) {
  top[x] = tp;
  id[x] = ++cnt;
  con[cnt] = x;
  if (son[x]) dfs2(son[x], tp);
  for (int i = 0; i < g[x].size(); ++i)
    if (!id[g[x][i]]) dfs2(g[x][i], g[x][i]);
}
int mn[N << 2];
void build(int p, int l, int r) {
  if (l == r) return mn[p] = val[con[l]], void(0);
  int mid = (l + r) >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
  mn[p] = min(mn[p << 1], mn[p << 1 | 1]);
}
void upt(int p, int l, int r, int pos, int v) {
  if (l == r) return mn[p] = v, void(0);
  int mid = (l + r) >> 1;
  if (pos <= mid)
    upt(p << 1, l, mid, pos, v);
  else
    upt(p << 1 | 1, mid + 1, r, pos, v);
  mn[p] = min(mn[p << 1], mn[p << 1 | 1]);
}
int query(int p, int l, int r, int ql, int qr) {
  if (ql <= l && r <= qr) return mn[p];
  int mid = (l + r) >> 1, res = 1e9;
  if (ql <= mid) res = query(p << 1, l, mid, ql, qr);
  if (mid + 1 <= qr) res = min(res, query(p << 1 | 1, mid + 1, r, ql, qr));
  return res;
}
int Query(int x, int y) {
  int res = 1e9;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    res = min(res, query(1, 1, cnt, id[top[x]], id[x]));
    x = fa[top[x]];
  }
  if (id[x] > id[y]) swap(x, y);
  res = min(res, query(1, 1, cnt, id[x], id[y]));
  if (x > n) res = min(res, val[fa[x]]);
  return res;
}
int main() {
  int m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; ++i) cin >> val[i];
  int u, v;
  for (int i = 1; i <= m; ++i) {
    cin >> u >> v;
    e[u].push_back(v);
    e[v].push_back(u);
  }
  ccnt = n;
  tarjan(1);
  dfs1(1, 0);
  dfs2(1, 1);
  for (int i = 1; i <= n; ++i)
    if (fa[i]) dis[fa[i]].insert(val[i]);
  for (int i = n + 1; i <= ccnt; ++i) val[i] = *dis[i].begin();
  build(1, 1, cnt);
  char opt;
  while (q--) {
    cin >> opt;
    if (opt == 'C') {
      cin >> u >> v;
      upt(1, 1, cnt, id[u], v);
      if (fa[u]) {
        dis[fa[u]].erase(dis[fa[u]].find(val[u]));
        dis[fa[u]].insert(v);
        if (val[fa[u]] != *dis[fa[u]].begin()) {
          val[fa[u]] = *dis[fa[u]].begin();
          upt(1, 1, cnt, id[fa[u]], val[fa[u]]);
        }
      }
      val[u] = v;
    } else {
      cin >> u >> v;
      cout << Query(u, v) << endl;
    }
  }
  return 0;
}
