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 maxn = 400003, maxlog = 18, INF = 0x3f3f3f3f;
struct edge {
  int to, next;
} e[maxn];
int head[maxn], cnte;
void add(int u, int v) { e[++cnte] = (edge){v, head[u]}, head[u] = cnte; }
int n, m, Q, n2, a[maxn], fa[maxn], sz[maxn], dep[maxn], son[maxn], top[maxn],
    dfn[maxn], cntdfn, rig[maxn], num[maxn], t[maxn << 2];
multiset<int> st[maxn];
int flip(int i) { return i & 1 ? i + 1 : i - 1; }
vector<int> g[maxn];
void ADDEDGE(int u, int v) { g[u].push_back(v), g[v].push_back(u); }
void tarjan(int u) {
  static int low[maxn], dfn[maxn], cntdfn = 0, stk[maxn], top = 0;
  dfn[u] = low[u] = ++cntdfn;
  stk[++top] = u;
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].to;
    if (!dfn[v]) {
      tarjan(v);
      low[u] = min(low[u], low[v]);
      if (low[v] >= dfn[u]) {
        n2++;
        int x;
        do {
          x = stk[top--];
          ADDEDGE(n2, x);
        } while (x != v);
        ADDEDGE(n2, u);
      }
    } else
      low[u] = min(low[u], dfn[v]);
  }
}
void init1(int u) {
  int mx = 0;
  sz[u] = 1;
  for (int v : g[u]) {
    if (v == fa[u]) continue;
    fa[v] = u;
    dep[v] = dep[u] + 1;
    init1(v);
    sz[u] += sz[v];
    if (sz[v] > mx) mx = sz[v], son[u] = v;
  }
}
void init2(int u, int tp) {
  dfn[u] = ++cntdfn;
  num[cntdfn] = u;
  top[u] = tp;
  if (son[u]) init2(son[u], tp);
  for (int v : g[u]) {
    if (v == fa[u] || v == son[u]) continue;
    init2(v, v);
  }
  rig[u] = cntdfn;
}
void pushup(int p) { t[p] = min(t[p << 1], t[p << 1 | 1]); }
void build(int p, int l, int r) {
  if (l == r) {
    t[p] = *st[num[l]].begin();
    return;
  }
  int mid = (l + r) >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
  pushup(p);
}
void change(int p, int l, int r, int pos, int k1, int k2) {
  if (l == r) {
    st[num[l]].erase(st[num[l]].find(k1)), st[num[l]].insert(k2);
    t[p] = *st[num[l]].begin();
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    change(p << 1, l, mid, pos, k1, k2);
  else
    change(p << 1 | 1, mid + 1, r, pos, k1, k2);
  pushup(p);
}
int query(int p, int l, int r, int seg_l, int seg_r) {
  if (seg_l <= l && r <= seg_r) return t[p];
  int mid = (l + r) >> 1, ret = INF;
  if (seg_l <= mid) ret = min(ret, query(p << 1, l, mid, seg_l, seg_r));
  if (seg_r > mid) ret = min(ret, query(p << 1 | 1, mid + 1, r, seg_l, seg_r));
  return ret;
}
void build() {
  n2 = n;
  tarjan(1);
  init1(1), init2(1, 1);
  for (int i = 1; i <= n; i++) {
    st[i].insert(a[i]);
    if (fa[i] > n) st[fa[i]].insert(a[i]);
  }
  build(1, 1, n2);
}
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(1, 1, n2, dfn[top[x]], dfn[x]));
    x = fa[top[x]];
  }
  if (dep[x] < dep[y]) swap(x, y);
  ret = min(ret, query(1, 1, n2, dfn[y], dfn[x]));
  if (y > n) ret = min(ret, *st[fa[y]].begin());
  return ret;
}
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v), add(v, u);
  }
  build();
  while (Q--) {
    char mo[2];
    int x, y;
    scanf("%s%d%d", mo, &x, &y);
    if (*mo == 'C') {
      change(1, 1, n2, dfn[x], a[x], y);
      if (fa[x] > n) change(1, 1, n2, dfn[fa[x]], a[x], y);
      a[x] = y;
    } else
      printf("%d\n", query(x, y));
  }
  return 0;
}
