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;
int n, m, hed[200010], cnt, hed2[200010], cnt2, q, w[200010], ct;
int low[200010], dfn[200010], sta[200010], top, z;
int tp[200010], sz[200010], fa[200010], dep[200010], son[200010], ys[200010],
    yss[200010];
struct node {
  int to, next;
} a[400010], aa[800010];
struct tree {
  int l, r, mn;
} tr[2000010];
char opt;
multiset<int> s[400010];
inline void add(int from, int to) {
  a[++cnt].to = to;
  a[cnt].next = hed[from];
  hed[from] = cnt;
}
inline void add2(int from, int to) {
  aa[++cnt2].to = to;
  aa[cnt2].next = hed2[from];
  hed2[from] = cnt2;
}
inline void tarjan(int x) {
  low[x] = dfn[x] = ++z;
  sta[++top] = x;
  for (int i = hed[x]; i; i = a[i].next) {
    int y = a[i].to;
    if (!dfn[y]) {
      tarjan(y);
      low[x] = min(low[x], low[y]);
      if (low[y] >= dfn[x]) {
        ++ct;
        int mn = 2e9;
        do {
          add2(ct, sta[top]);
          add2(sta[top], ct);
          --top;
        } while (sta[top + 1] != y);
        add2(x, ct);
        add2(ct, x);
        mn = min(mn, w[x]);
        w[ct] = mn;
      }
    } else
      low[x] = min(low[x], dfn[y]);
  }
}
inline void dfs(int x) {
  sz[x] = 1;
  for (int i = hed2[x]; i; i = aa[i].next) {
    int y = aa[i].to;
    if (y == fa[x]) continue;
    fa[y] = x;
    dep[y] = dep[x] + 1;
    dfs(y);
    sz[x] += sz[y];
    if (sz[y] > sz[son[x]]) son[x] = y;
  }
}
inline void dfs2(int x, int top) {
  tp[x] = top;
  ys[x] = ++z;
  yss[z] = x;
  if (son[x]) {
    dfs2(son[x], top);
    for (int i = hed2[x]; i; i = aa[i].next) {
      int y = aa[i].to;
      if (y != fa[x] && y != son[x]) dfs2(y, y);
    }
  }
}
inline void pushup(int rt) {
  tr[rt].mn = min(tr[rt << 1].mn, tr[rt << 1 | 1].mn);
}
inline void build(int rt, int l, int r) {
  tr[rt].l = l;
  tr[rt].r = r;
  if (l == r) {
    tr[rt].mn = w[yss[l]];
    return;
  }
  int mid = (l + r) >> 1;
  build(rt << 1, l, mid);
  build(rt << 1 | 1, mid + 1, r);
  pushup(rt);
}
inline void update(int rt, int x, int y) {
  int l = tr[rt].l, r = tr[rt].r;
  if (l == r) {
    tr[rt].mn = y;
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid)
    update(rt << 1, x, y);
  else
    update(rt << 1 | 1, x, y);
  pushup(rt);
}
inline int query(int rt, int le, int ri) {
  int l = tr[rt].l, r = tr[rt].r;
  if (le <= l && r <= ri) return tr[rt].mn;
  int mid = (l + r) >> 1, res = 2e9;
  if (le <= mid) res = min(res, query(rt << 1, le, ri));
  if (mid + 1 <= ri) res = min(res, query(rt << 1 | 1, le, ri));
  return res;
}
inline int find(int x, int y) {
  int fx = tp[x], fy = tp[y], ans = 2e9;
  while (fx != fy) {
    if (dep[fx] < dep[fy]) {
      swap(x, y);
      swap(fx, fy);
    }
    ans = min(ans, query(1, ys[fx], ys[x]));
    x = fa[fx];
    fx = tp[x];
  }
  if (dep[x] > dep[y]) swap(x, y);
  ans = min(ans, query(1, ys[x], ys[y]));
  if (x > ct) ans = min(ans, w[fa[x]]);
  return ans;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  ct = n;
  for (int i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  for (int i = 1; i <= n; ++i) {
    if (!dfn[i]) tarjan(i);
  }
  z = 0;
  dep[1] = 1;
  dfs(1);
  dfs2(1, 1);
  for (int i = n + 1; i <= ct; ++i) {
    for (int j = hed2[i]; j; j = aa[j].next) {
      int y = aa[j].to;
      if (y != fa[i]) s[i].insert(w[y]);
    }
    if (s[i].empty())
      w[i] = 2e9;
    else
      w[i] = *s[i].begin();
  }
  swap(n, ct);
  build(1, 1, n);
  for (int i = 1; i <= q; ++i) {
    opt = getchar();
    while (opt != 'A' && opt != 'C') opt = getchar();
    int x, y;
    scanf("%d%d", &x, &y);
    if (opt == 'A')
      printf("%d\n", find(x, y));
    else {
      if (fa[x]) {
        s[fa[x]].erase(s[fa[x]].find(w[x]));
        s[fa[x]].insert(y);
        w[fa[x]] = *s[fa[x]].begin();
        update(1, ys[fa[x]], w[fa[x]]);
      }
      w[x] = y;
      update(1, ys[x], y);
    }
  }
  return 0;
}
