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;
inline int gi() {
  char c;
  int num = 0, flg = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flg = -1;
  while (c >= '0' && c <= '9') {
    num = num * 10 + c - 48;
    c = getchar();
  }
  return num * flg;
}
int n, m, Q;
int val[200005];
multiset<int> S[200005];
int fir[200005], to[2 * 200005], nxt[2 * 200005], cnt;
void adde(int a, int b) {
  to[++cnt] = b;
  nxt[cnt] = fir[a];
  fir[a] = cnt;
  to[++cnt] = a;
  nxt[cnt] = fir[b];
  fir[b] = cnt;
}
int dfn[200005], low[200005], stk[200005], tp, dc;
vector<int> G[200005], gid[200005];
int tot;
void dfs(int u, int pp) {
  dfn[u] = low[u] = ++dc;
  stk[tp++] = u;
  for (int v, i = 0; i < int(G[u].size()); i++) {
    if (gid[u][i] != pp) {
      v = G[u][i];
      if (!dfn[v]) {
        dfs(v, gid[u][i]);
        low[u] = min(low[u], low[v]);
        if (low[v] >= dfn[u]) {
          adde(u, ++tot);
          while (tp > 0) {
            adde(tot, stk[--tp]);
            if (stk[tp] == v) break;
          }
        }
      } else
        low[u] = min(low[u], dfn[v]);
    }
  }
}
int siz[200005], top[200005], son[200005], dep[200005], fa[200005];
void dfs1(int u) {
  dep[u] = dep[fa[u]] + 1;
  siz[u] = 1;
  for (int v, p = fir[u]; p; p = nxt[p]) {
    if ((v = to[p]) != fa[u]) {
      fa[v] = u;
      dfs1(v);
      siz[u] += siz[v];
      if (siz[son[u]] < siz[v]) son[u] = v;
    }
  }
}
int pos[200005], ddc, num[200005];
void dfs2(int u) {
  pos[u] = ++ddc;
  num[ddc] = u;
  if (son[u]) top[son[u]] = top[u], dfs2(son[u]);
  for (int v, p = fir[u]; p; p = nxt[p])
    if ((v = to[p]) != fa[u] && v != son[u]) top[v] = v, dfs2(v);
}
struct node {
  int l, r, x;
} a[200005 << 2];
void build(int i, int l, int r) {
  a[i].l = l;
  a[i].r = r;
  if (l == r) {
    a[i].x = val[num[l]];
    return;
  }
  int mid = (l + r) >> 1;
  build(i << 1, l, mid);
  build(i << 1 | 1, mid + 1, r);
  a[i].x = min(a[i << 1].x, a[i << 1 | 1].x);
}
void insert(int i, int x, int k) {
  if (a[i].l > x || a[i].r < x) return;
  if (a[i].l == x && a[i].r == x) {
    a[i].x = k;
    return;
  }
  insert(i << 1, x, k);
  insert(i << 1 | 1, x, k);
  a[i].x = min(a[i << 1].x, a[i << 1 | 1].x);
}
const int INF = 0x3f3f3f3f;
int query(int i, int l, int r) {
  if (a[i].l > r || a[i].r < l) return INF;
  if (l <= a[i].l && a[i].r <= r) return a[i].x;
  return min(query(i << 1, l, r), query(i << 1 | 1, l, r));
}
int QP(int x, int y) {
  int ans = INF;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    ans = min(ans, query(1, pos[top[x]], pos[x]));
    x = fa[top[x]];
  }
  if (dep[x] > dep[y]) swap(x, y);
  ans = min(ans, query(1, pos[x], pos[y]));
  if (x > n) ans = min(ans, val[fa[x]]);
  return ans;
}
char ss[4];
int main() {
  cnt = 1;
  int i, u, v;
  n = gi();
  m = gi();
  Q = gi();
  for (i = 1; i <= n; i++) val[i] = gi();
  for (i = 1; i <= m; i++) {
    u = gi();
    v = gi();
    G[u].push_back(v);
    gid[u].push_back(i);
    G[v].push_back(u);
    gid[v].push_back(i);
  }
  tot = n;
  for (i = 1; i <= n; i++)
    if (!dfn[i]) dfs(i, 0);
  dfs1(1);
  top[1] = 1;
  dfs2(1);
  for (i = 1; i <= n; i++)
    if (fa[i]) S[fa[i]].insert(val[i]);
  for (i = n + 1; i <= tot; i++) val[i] = *S[i].begin();
  build(1, 1, tot);
  while (Q--) {
    scanf("%s", ss);
    u = gi();
    v = gi();
    if (ss[0] == 'A')
      printf("%d\n", QP(u, v));
    else {
      if (fa[u]) {
        S[fa[u]].erase(S[fa[u]].find(val[u]));
        val[u] = v;
        S[fa[u]].insert(val[u]);
        val[fa[u]] = *S[fa[u]].begin();
        insert(1, pos[fa[u]], val[fa[u]]);
        insert(1, pos[u], val[u]);
      } else {
        val[u] = v;
        insert(1, pos[u], val[u]);
      }
    }
  }
}
