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;
multiset<int> S[202300];
multiset<int>::iterator it;
struct node {
  int to, next;
} q[401200], tq[401200];
int head[202300], ss, w[202300], fa[202300], stk[202300], th[202300], ts, cc,
    dep[202300], dfn[202300], low[202300], tp[202300], son[202300], tm,
    minm[202300 << 2], top, sz[202300], idt[202300], n;
char s[10];
void addedge(int x, int y) {
  q[++ss] = (node){y, head[x]};
  head[x] = ss;
  q[++ss] = (node){x, head[y]};
  head[y] = ss;
}
void addtr(int x, int y) {
  tq[++ts] = (node){y, th[x]};
  th[x] = ts;
  tq[++ts] = (node){x, th[y]};
  th[y] = ts;
}
void tarjan(int i) {
  dfn[i] = low[i] = ++tm;
  stk[++top] = i;
  for (int j = head[i]; j; j = q[j].next) {
    int t = q[j].to;
    if (!dfn[t]) {
      tarjan(t);
      low[i] = min(low[i], low[t]);
      if (low[t] >= dfn[i]) {
        addtr(i, ++cc);
        do addtr(cc, stk[top]);
        while (stk[top--] ^ t);
      }
    } else
      low[i] = min(low[i], dfn[t]);
  }
}
void dfs1(int i) {
  sz[i] = 1;
  dep[i] = dep[fa[i]] + 1;
  for (int j = th[i]; j; j = tq[j].next)
    if (tq[j].to ^ fa[i]) {
      int t = tq[j].to;
      fa[t] = i;
      dfs1(t);
      sz[i] += sz[t];
      if (sz[t] > sz[son[i]]) son[i] = t;
    }
}
void dfs2(int i, int T) {
  dfn[i] = ++tm;
  idt[tm] = i;
  tp[i] = T;
  if (son[i]) dfs2(son[i], T);
  for (int j = th[i]; j; j = tq[j].next)
    if (!dfn[tq[j].to]) dfs2(tq[j].to, tq[j].to);
}
void build(int i, int l, int r) {
  if (l == r) {
    minm[i] = *S[idt[l]].begin();
    return;
  }
  int mid = l + r >> 1;
  build(i << 1, l, mid);
  build(i << 1 | 1, mid + 1, r);
  minm[i] = min(minm[i << 1], minm[i << 1 | 1]);
}
void update(int i, int l, int r, int pos, int k) {
  if (l == r) {
    minm[i] = k;
    return;
  }
  int mid = l + r >> 1;
  if (pos <= mid)
    update(i << 1, l, mid, pos, k);
  else
    update(i << 1 | 1, mid + 1, r, pos, k);
  minm[i] = min(minm[i << 1], minm[i << 1 | 1]);
}
int query(int i, int l, int r, int L, int R) {
  if (L <= l && r <= R) return minm[i];
  int mid = l + r >> 1;
  if (R <= mid)
    return query(i << 1, l, mid, L, R);
  else if (L > mid)
    return query(i << 1 | 1, mid + 1, r, L, R);
  return min(query(i << 1, l, mid, L, R), query(i << 1 | 1, mid + 1, r, L, R));
}
int query(int x, int y) {
  int ans = 0x7f7f7f7f;
  while (tp[x] ^ tp[y]) {
    if (dep[tp[x]] < dep[tp[y]]) swap(x, y);
    ans = min(ans, query(1, 1, cc, dfn[tp[x]], dfn[x]));
    x = fa[tp[x]];
  }
  if (dep[x] > dep[y]) swap(x, y);
  ans = min(ans, query(1, 1, cc, dfn[x], dfn[y]));
  ans = min(ans, w[x > n ? fa[x] : x]);
  return ans;
}
inline int read() {
  int n = 0;
  char a;
  bool z = false;
  while (a = getchar()) {
    if (a > '9' || a < '0')
      if (z)
        break;
      else
        continue;
    if (!z) z = true;
    n = (n << 1) + (n << 3) + (a ^ 48);
  }
  return n;
}
int main() {
  n = read();
  int m = read(), Q = read(), x, y;
  cc = n;
  for (int i = 1; i <= n; ++i) w[i] = read();
  for (int i = 1; i <= m; ++i) addedge(read(), read());
  tarjan(1);
  dfs1(1);
  tm = 0;
  memset(dfn, 0, sizeof(dfn));
  dfs2(1, 1);
  for (int i = 1; i <= cc; ++i) S[i].insert(0x7f7f7f7f);
  for (int i = 1; i <= n; ++i)
    if (fa[i]) S[fa[i]].insert(w[i]);
  build(1, 1, cc);
  while (Q--) {
    scanf("%s", s + 1);
    x = read();
    y = read();
    if (s[1] == 'C') {
      if (fa[x]) {
        it = S[fa[x]].find(w[x]);
        S[fa[x]].erase(it);
        S[fa[x]].insert(w[x] = y);
        update(1, 1, cc, dfn[fa[x]], *S[fa[x]].begin());
      } else
        w[x] = y;
    } else
      printf("%d\n", query(x, y));
  }
  return 0;
}
