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 + 5, inf = 1e9;
vector<int> v[N], dcc[N];
struct Link {
  int to, nxt;
} l[N << 1];
int n, m, Q, w[N], head[N], tot;
inline int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') f = ch == '-' ? -1 : f, ch = getchar();
  while (ch >= '0' && ch <= '9')
    s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
  return s * f;
}
inline void add(int x, int y) {
  l[++tot].to = y;
  l[tot].nxt = head[x];
  head[x] = tot;
}
int dfn[N], low[N], bl[N], cut[N], st[N], val[N], rt, now, tp, cnt;
void tarjan(int x) {
  dfn[x] = low[x] = ++now;
  st[++tp] = x;
  int flag = 0;
  for (auto y : v[x]) {
    if (!dfn[y]) {
      tarjan(y);
      low[x] = min(low[x], low[y]);
      if (low[y] >= dfn[x]) {
        flag++;
        if (x != rt || flag > 1) cut[x] = 1;
        cnt++;
        int z = 0;
        do {
          z = st[tp--];
          bl[z] = cnt;
          dcc[cnt].push_back(z);
          add(z, cnt), add(cnt, z);
        } while (z != y);
        dcc[cnt].push_back(x);
        add(x, cnt), add(cnt, x);
      }
    } else
      low[x] = min(low[x], dfn[y]);
  }
}
multiset<int> s[N];
int son[N], sz[N], top[N], fa[N], rk[N], id[N], d[N], node;
void dfs(int x, int f) {
  sz[x] = 1;
  fa[x] = f;
  d[x] = d[f] + 1;
  for (int i = head[x]; i; i = l[i].nxt) {
    int y = l[i].to;
    if (y == f) continue;
    dfs(y, x);
    sz[x] += sz[y];
    if (sz[y] > sz[son[x]]) son[x] = y;
  }
}
void dfs(int x, int f, int tp) {
  top[x] = tp;
  id[x] = ++node;
  rk[node] = x;
  if (!son[x]) return;
  dfs(son[x], x, tp);
  for (int i = head[x]; i; i = l[i].nxt) {
    int y = l[i].to;
    if (y == f || y == son[x]) continue;
    dfs(y, x, y);
  }
  if (x <= n) return;
  for (int i = head[x]; i; i = l[i].nxt)
    if (l[i].to != f) s[id[x]].insert(w[l[i].to]);
}
int mx[N << 2];
void build(int k, int l, int r) {
  if (l == r) return mx[k] = *(s[l].begin()), void();
  int mid = l + r >> 1;
  build(k << 1, l, mid);
  build(k << 1 | 1, mid + 1, r);
  mx[k] = min(mx[k << 1], mx[k << 1 | 1]);
}
void modify(int k, int l, int r, int pos) {
  if (l == r) return mx[k] = *(s[l].begin()), void();
  int mid = l + r >> 1;
  if (mid >= pos) modify(k << 1, l, mid, pos);
  if (mid < pos) modify(k << 1 | 1, mid + 1, r, pos);
  mx[k] = min(mx[k << 1], mx[k << 1 | 1]);
}
int query(int k, int l, int r, int L, int R) {
  if (L <= l && r <= R) return mx[k];
  int mid = l + r >> 1, res = inf;
  if (mid >= L) res = min(res, query(k << 1, l, mid, L, R));
  if (mid < R) res = min(res, query(k << 1 | 1, mid + 1, r, L, R));
  return res;
}
int get_ans(int x, int y) {
  int ans = inf, fx = top[x], fy = top[y];
  while (fx != fy) {
    if (d[fx] < d[fy]) swap(x, y), swap(fx, fy);
    ans = min(ans, query(1, 1, node, id[fx], id[x]));
    x = fa[fx];
    fx = top[x];
  }
  if (d[x] > d[y]) swap(x, y);
  ans = min(ans, query(1, 1, node, id[x], id[y]));
  if (x > n) ans = min(ans, w[fa[x]]);
  return ans;
}
int main() {
  n = read(), m = read(), Q = read();
  for (int i = 1; i <= n; ++i) w[i] = read();
  for (int i = 1; i <= m; ++i) {
    int x = read(), y = read();
    v[x].push_back(y);
    v[y].push_back(x);
  }
  cnt = n;
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) rt = i, tarjan(i);
  dfs(1, 0);
  dfs(1, 0, 1);
  for (int i = 1; i <= n; ++i) s[id[i]].insert(w[i]);
  build(1, 1, node);
  char opt[3];
  for (int i = 1; i <= Q; ++i) {
    scanf("%s", opt);
    int x = read(), y = read();
    if (opt[0] == 'A') printf("%d\n", get_ans(x, y));
    if (opt[0] == 'C') {
      s[id[x]].erase(w[x]);
      s[id[fa[x]]].erase(w[x]);
      w[x] = y;
      s[id[x]].insert(w[x]);
      s[id[fa[x]]].insert(w[x]);
      modify(1, 1, node, id[x]);
      modify(1, 1, node, id[fa[x]]);
    }
  }
  return 0;
}
