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 = 2e5 + 55, M = 1e5 + 55;
char ss[1 << 21], *A = ss, *B = ss, cc;
inline char gc() {
  return A == B && (B = (A = ss) + fread(ss, 1, 1 << 21, stdin), A == B) ? EOF
                                                                         : *A++;
}
template <class T>
inline void rd(T &x) {
  int f = 1;
  x = 0, cc = gc();
  while (cc < '0' || cc > '9') {
    if (cc == '-') f = -1;
    cc = gc();
  }
  while (cc >= '0' && cc <= '9') {
    x = (x << 3) + (x << 1) + (cc ^ 48);
    cc = gc();
  }
  x *= f;
}
const int inf = 0x3f3f3f3f;
int n, m, q, _ct, ct, clk, DFN, top, ext;
int _head[N], head[N], low[N], dfn[N], stk[N], w[N];
int dep[N], fa[N], Top[N], mn[N << 2], size[N], son[N], id[N], _w[N];
struct edge {
  int v, nxt;
} _e[M << 1], e[M << 2];
multiset<int> s[N];
multiset<int>::iterator it;
vector<int> G[N];
inline void _adde(int from, int to) {
  _e[++_ct].v = to;
  _e[_ct].nxt = _head[from];
  _head[from] = _ct;
}
inline void adde(int from, int to) {
  e[++ct].v = to;
  e[ct].nxt = head[from];
  head[from] = ct;
}
void tarjan(int x) {
  dfn[x] = low[x] = ++clk;
  stk[top++] = x;
  for (int i = _head[x]; i; i = _e[i].nxt) {
    int v = _e[i].v;
    if (!dfn[v]) {
      tarjan(v);
      low[x] = min(low[x], low[v]);
      if (low[v] >= dfn[x]) {
        w[++ext] = inf;
        do {
          int z = stk[--top];
          w[ext] = min(w[ext], w[z]);
          s[ext].insert(w[z]);
          adde(ext, z);
          adde(z, ext);
        } while (stk[top] != v);
        adde(ext, x);
        adde(x, ext);
      }
    } else
      low[x] = min(low[x], dfn[v]);
  }
}
void dfs(int x, int depth) {
  dep[x] = depth;
  size[x] = 1;
  int maxs = 0;
  for (int i = head[x]; i; i = e[i].nxt) {
    int v = e[i].v;
    if (v == fa[x]) continue;
    fa[v] = x;
    dfs(v, depth + 1);
    size[x] += size[v];
    if (size[v] > maxs) {
      maxs = size[v];
      son[x] = v;
    }
  }
}
void dfs2(int x, int topp) {
  Top[x] = topp, id[x] = ++DFN, _w[DFN] = w[x];
  if (!son[x])
    return;
  else
    dfs2(son[x], topp);
  for (int i = head[x]; i; i = e[i].nxt) {
    int v = e[i].v;
    if (v == fa[x] || v == son[x]) continue;
    dfs2(v, v);
  }
}
void buildtree(int l, int r, int rt) {
  if (l == r) {
    mn[rt] = _w[l];
    return;
  }
  int mid = (l + r) >> 1;
  buildtree(l, mid, rt << 1);
  buildtree(mid + 1, r, rt << 1 | 1);
  mn[rt] = min(mn[rt << 1], mn[rt << 1 | 1]);
}
int query(int x, int y, int l, int r, int rt) {
  if (x <= l && r <= y) return mn[rt];
  int mid = (l + r) >> 1;
  if (x <= mid && y > mid)
    return min(query(x, y, l, mid, rt << 1),
               query(x, y, mid + 1, r, rt << 1 | 1));
  else if (x <= mid)
    return query(x, y, l, mid, rt << 1);
  else
    return query(x, y, mid + 1, r, rt << 1 | 1);
}
void update(int x, int k, int l, int r, int rt) {
  if (l == r) {
    mn[rt] = k;
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid) update(x, k, l, mid, rt << 1);
  if (x > mid) update(x, k, mid + 1, r, rt << 1 | 1);
  mn[rt] = min(mn[rt << 1], mn[rt << 1 | 1]);
}
int Query(int x, int y) {
  int ret = inf;
  while (Top[x] != Top[y]) {
    if (dep[Top[x]] < dep[Top[y]]) swap(x, y);
    ret = min(ret, query(id[Top[x]], id[x], 1, ext, 1));
    x = fa[Top[x]];
  }
  if (dep[x] > dep[y]) swap(x, y);
  if (x > n && fa[x]) ret = min(ret, query(id[fa[x]], id[fa[x]], 1, ext, 1));
  ret = min(ret, query(id[x], id[y], 1, ext, 1));
  return ret;
}
void Update(int x, int k) {
  int fz = fa[x];
  if (fz != 0) {
    it = s[fz].lower_bound(w[x]);
    s[fz].erase(it);
    s[fz].insert(k);
    int tw = *s[fz].begin();
    w[fz] = tw;
    update(id[fz], tw, 1, ext, 1);
  }
  update(id[x], k, 1, ext, 1);
  w[x] = k;
}
int main() {
  rd(n), rd(m), rd(q);
  int x, y;
  for (int i = (1); i <= (n); ++i) rd(w[i]);
  for (int i = (1); i <= (m); ++i) {
    rd(x), rd(y);
    _adde(x, y), _adde(y, x);
  }
  ext = n;
  tarjan(1);
  dfs(1, 0);
  dfs2(1, 1);
  buildtree(1, ext, 1);
  for (int i = (1); i <= (q); ++i) {
    while (cc != 'C' && cc != 'A') cc = gc();
    if (cc == 'C') {
      rd(x), rd(y);
      Update(x, y);
    } else {
      rd(x), rd(y);
      printf("%d\n", Query(x, y));
    }
  }
  return 0;
}
