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;
vector<int> V[200001];
multiset<int> S[200001];
int n, m, Q, i, t, x, y, an, id, tot, scc, a[200001], fir[200001], q[200001];
int hs[200001], F[200001], dfn[200001], low[200001], sz[200001];
int lb[200001], ne[200001], la[200001], E[600001], st[200001];
int to[200001], bl[200001], h[200001];
char s[3];
void insert(int x, int y) {
  la[++tot] = y;
  ne[tot] = fir[x];
  fir[x] = tot;
}
void tj(int x, int fa) {
  dfn[x] = low[x] = ++id;
  q[++t] = x;
  int i, y, o;
  for (i = 0; i < V[x].size(); i++)
    if (!dfn[y = V[x][i]]) {
      tj(y, x);
      low[x] = min(low[x], low[y]);
      if (low[y] >= dfn[x]) {
        insert(x, ++scc);
        o = 0;
        while (y != o) {
          lb[o = q[t--]] = scc;
          insert(scc, o);
          S[scc].insert(a[o]);
        }
      }
    } else if (y != fa)
      low[x] = min(low[x], dfn[y]);
}
void dfs(int x) {
  sz[x] = 1;
  int i, y;
  for (i = fir[x]; i; i = ne[i])
    if (F[x] != la[i]) {
      F[y = la[i]] = x;
      h[y] = h[x] + 1;
      dfs(y);
      sz[x] += sz[y];
      if (sz[y] > sz[hs[x]]) hs[x] = y;
    }
}
void dfs2(int x, int f) {
  st[x] = ++id;
  to[id] = x;
  bl[x] = f;
  if (hs[x]) dfs2(hs[x], f);
  for (int i = fir[x]; i; i = ne[i])
    if ((F[x] != la[i]) && (la[i] != hs[x])) dfs2(la[i], la[i]);
}
void cg(int k, int l, int r, int x, int z) {
  if (l == r) {
    E[k] = z;
    return;
  }
  int md = l + r >> 1;
  (x <= md) ? cg(k << 1, l, md, x, z) : cg(k << 1 | 1, md + 1, r, x, z);
  E[k] = min(E[k << 1], E[k << 1 | 1]);
}
int qu(int k, int l, int r, int x, int y) {
  if (x <= l && r <= y) return E[k];
  int md = l + r >> 1, o = 1e9;
  if (x <= md) o = qu(k << 1, l, md, x, y);
  if (y > md) o = min(o, qu(k << 1 | 1, md + 1, r, x, y));
  return o;
}
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  for (scc = n, i = 1; i <= n; i++) scanf("%d", &a[i]);
  while (m--) {
    scanf("%d%d", &x, &y);
    V[x].push_back(y);
    V[y].push_back(x);
  }
  tj(1, 0);
  id = 0;
  dfs(1);
  dfs2(1, 1);
  for (i = 1; i <= id; i++) cg(1, 1, id, st[i], i <= n ? a[i] : *S[i].begin());
  while (Q--) {
    scanf("%s%d%d", s, &x, &y);
    if (s[0] == 'C') {
      if (lb[x]) {
        S[lb[x]].erase(S[lb[x]].find(a[x]));
        S[lb[x]].insert(y);
        cg(1, 1, scc, st[lb[x]], *S[lb[x]].begin());
      }
      cg(1, 1, scc, st[x], a[x] = y);
    } else {
      an = 1e9;
      while (bl[x] != bl[y]) {
        if (h[bl[x]] < h[bl[y]]) swap(x, y);
        an = min(an, qu(1, 1, scc, st[bl[x]], st[x]));
        x = F[bl[x]];
      }
      if (st[x] > st[y]) swap(x, y);
      an = min(an, qu(1, 1, scc, st[x], st[y]));
      if ((x > n) && (F[x])) an = min(an, a[F[x]]);
      printf("%d\n", an);
    }
  }
}
