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 = 1e6 + 5;
int n, m, gs, Top, ans, q, Top2, cnt, deep, tot, dfn[N], low[N], zhan[N],
    size[N], son[N];
int a[N], val[N], head[N], head2[N], seg[N], top[N], rev[N], dep[N], fa[N],
    tree[N];
struct node {
  int too, Next;
} edge[N * 2], edge2[N * 2];
multiset<int> s[N];
multiset<int>::iterator it;
inline int read() {
  int ret = 0, f = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (isdigit(c)) {
    ret = ret * 10 + c - 48;
    c = getchar();
  }
  if (f) return -ret;
  return ret;
}
void add(int a, int b) {
  edge[++Top].too = b;
  edge[Top].Next = head[a];
  head[a] = Top;
}
void add2(int a, int b) {
  edge2[++Top2].too = b;
  edge2[Top2].Next = head2[a];
  head2[a] = Top2;
}
void tarjan(int u) {
  dfn[u] = low[u] = ++deep;
  zhan[++tot] = u;
  for (int i = head[u]; i; i = edge[i].Next) {
    int v = edge[i].too;
    if (!dfn[v]) {
      tarjan(v);
      low[u] = min(low[u], low[v]);
      if (low[v] >= dfn[u]) {
        cnt++;
        while (zhan[tot] != v) {
          add2(zhan[tot], cnt);
          add2(cnt, zhan[tot]);
          tot--;
        }
        tot--;
        add2(cnt, u);
        add2(u, cnt);
        add2(cnt, v);
        add2(v, cnt);
      }
    } else
      low[u] = min(low[u], dfn[v]);
  }
}
void dfs(int u, int f) {
  size[u] = 1;
  dep[u] = dep[f] + 1;
  fa[u] = f;
  for (int i = head2[u]; i; i = edge2[i].Next) {
    int v = edge2[i].too;
    if (v == f) continue;
    dfs(v, u);
    size[u] += size[v];
    if (size[v] > size[son[u]]) son[u] = v;
  }
}
void dfs2(int u, int f) {
  if (son[u]) {
    rev[++seg[0]] = son[u];
    seg[son[u]] = seg[0];
    top[son[u]] = top[u];
    dfs2(son[u], u);
  }
  for (int i = head2[u]; i; i = edge2[i].Next) {
    int v = edge2[i].too;
    if (!top[v]) {
      rev[++seg[0]] = v;
      seg[v] = seg[0];
      top[v] = v;
      dfs2(v, u);
    }
  }
}
void build(int nod, int l, int r) {
  if (l == r) {
    tree[nod] = a[rev[l]];
    return;
  }
  int mid = (l + r) / 2;
  build(nod * 2, l, mid);
  build(nod * 2 + 1, mid + 1, r);
  tree[nod] = min(tree[nod * 2], tree[nod * 2 + 1]);
}
void change(int nod, int l, int r, int x, int val) {
  if (l == r) {
    tree[nod] = val;
    return;
  }
  int mid = (l + r) / 2;
  if (x <= mid)
    change(nod * 2, l, mid, x, val);
  else
    change(nod * 2 + 1, mid + 1, r, x, val);
  tree[nod] = min(tree[nod * 2], tree[nod * 2 + 1]);
}
int find(int nod, int l, int r, int L, int R) {
  if (l == L && r == R) return tree[nod];
  int mid = (l + r) / 2;
  if (R <= mid)
    return find(nod * 2, l, mid, L, R);
  else if (L > mid)
    return find(nod * 2 + 1, mid + 1, r, L, R);
  else
    return min(find(nod * 2, l, mid, L, mid),
               find(nod * 2 + 1, mid + 1, r, mid + 1, R));
}
int query(int x, int y) {
  int fx = top[x], fy = top[y], ans = 1e9;
  while (fx != fy) {
    if (dep[fx] < dep[fy]) {
      swap(x, y);
      swap(fx, fy);
    }
    ans = min(ans, find(1, 1, cnt, seg[fx], seg[x]));
    x = fa[fx];
    fx = top[x];
  }
  if (dep[x] > dep[y]) swap(x, y);
  ans = min(ans, find(1, 1, cnt, seg[x], seg[y]));
  if (x > n) ans = min(ans, a[fa[x]]);
  return ans;
}
signed main() {
  n = read();
  m = read();
  q = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  cnt = n;
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    add(x, y);
    add(y, x);
  }
  tarjan(1);
  dfs(1, 0);
  seg[0] = seg[1] = rev[1] = top[1] = 1;
  dfs2(1, 0);
  for (int i = 1; i <= n; i++)
    if (fa[i]) s[fa[i]].insert(a[i]);
  for (int i = n + 1; i <= cnt; i++) a[i] = *s[i].begin();
  build(1, 1, cnt);
  char S[15];
  while (q--) {
    scanf("%s", S);
    int x = read(), y = read();
    if (S[0] == 'C') {
      change(1, 1, cnt, seg[x], y);
      if (fa[x]) {
        it = s[fa[x]].lower_bound(a[x]);
        s[fa[x]].erase(it);
        a[x] = y;
        s[fa[x]].insert(a[x]);
        a[fa[x]] = *s[fa[x]].begin();
        change(1, 1, cnt, seg[fa[x]], a[fa[x]]);
      }
      a[x] = y;
    } else
      printf("%d\n", query(x, y));
  }
  return 0;
}
