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 = 200005;
const int M = 400005;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f * x;
}
int n, m, q, num;
int hd[N], nxt[M], to[M], tot;
inline void add(int x, int y) {
  to[++tot] = y;
  nxt[tot] = hd[x];
  hd[x] = tot;
}
int dfn[N], low[N], dfn_cnt;
int st[N], tp;
bool vis[N];
vector<int> G[N];
void tarjan(int x) {
  vis[x] = 1;
  st[++tp] = x;
  dfn[x] = low[x] = ++dfn_cnt;
  for (int i = hd[x]; i; i = nxt[i]) {
    int y = to[i];
    if (!dfn[y]) {
      tarjan(y);
      low[x] = min(low[x], low[y]);
      if (low[y] == dfn[x]) {
        ++num;
        while (st[tp + 1] != y) {
          G[num].push_back(st[tp]);
          G[st[tp]].push_back(num);
          vis[st[tp--]] = 0;
        }
        G[num].push_back(x);
        G[x].push_back(num);
      }
    } else if (vis[y])
      low[x] = min(low[x], dfn[y]);
  }
}
multiset<int> s[N];
int siz[N], fa[N], dep[N], son[N];
void dfs_son(int x, int f) {
  fa[x] = f;
  siz[x] = 1;
  dep[x] = dep[f] + 1;
  for (int i = 0; i < G[x].size(); i++) {
    int y = G[x][i];
    if (y == f) continue;
    dfs_son(y, x);
    siz[x] += siz[y];
    if (siz[y] > siz[son[x]]) son[x] = y;
  }
}
int rev[N], top[N];
void dfs_chain(int x, int tp) {
  top[x] = tp;
  dfn[x] = ++dfn_cnt;
  rev[dfn_cnt] = x;
  if (son[x]) dfs_chain(son[x], tp);
  for (int i = 0; i < G[x].size(); i++) {
    int y = G[x][i];
    if (y == fa[x] || y == son[x]) continue;
    dfs_chain(y, y);
  }
}
int val[N << 2];
int w[N];
void build(int l, int r, int p) {
  if (l == r) {
    val[p] = w[rev[l]];
    return;
  }
  build(l, ((l + r) >> 1), (p << 1));
  build(((l + r) >> 1) + 1, r, (p << 1 | 1));
  val[p] = min(val[(p << 1)], val[(p << 1 | 1)]);
}
void modify(int l, int r, int t, int v, int p) {
  if (l == r) {
    val[p] = v;
    return;
  }
  if (t <= ((l + r) >> 1))
    modify(l, ((l + r) >> 1), t, v, (p << 1));
  else
    modify(((l + r) >> 1) + 1, r, t, v, (p << 1 | 1));
  val[p] = min(val[(p << 1)], val[(p << 1 | 1)]);
}
int query(int l, int r, int L, int R, int p) {
  if (L <= l && r <= R) return val[p];
  int ans = 0x3f3f3f3f;
  if (L <= ((l + r) >> 1))
    ans = min(ans, query(l, ((l + r) >> 1), L, R, (p << 1)));
  if (R > ((l + r) >> 1))
    ans = min(ans, query(((l + r) >> 1) + 1, r, L, R, (p << 1 | 1)));
  return ans;
}
int get_min(int x, int y) {
  int ans = 0x3f3f3f3f;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    ans = min(ans, query(1, num, dfn[top[x]], dfn[x], 1));
    x = fa[top[x]];
  }
  if (dfn[x] > dfn[y]) swap(x, y);
  ans = min(ans, query(1, num, dfn[x], dfn[y], 1));
  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();
  num = n;
  for (int i = 1, x, y; i <= m; i++) {
    x = read();
    y = read();
    add(x, y), add(y, x);
  }
  tarjan(1);
  dfn_cnt = 0;
  dfs_son(1, 0);
  dfs_chain(1, 1);
  for (int i = 1; i <= n; i++)
    if (fa[i]) s[fa[i]].insert(w[i]);
  for (int i = n + 1; i <= num; i++) w[i] = *s[i].begin();
  memset(val, 0x3f, sizeof(val));
  build(1, num, 1);
  char op;
  int x, y;
  while (q--) {
    cin >> op;
    x = read();
    y = read();
    if (op == 'C') {
      modify(1, num, dfn[x], y, 1);
      if (fa[x]) {
        s[fa[x]].erase(s[fa[x]].lower_bound(w[x]));
        s[fa[x]].insert(y);
        if (w[fa[x]] != *s[fa[x]].begin()) {
          w[fa[x]] = *s[fa[x]].begin();
          modify(1, num, dfn[fa[x]], w[fa[x]], 1);
        }
      }
      w[x] = y;
    } else
      printf("%d\n", get_min(x, y));
  }
  return 0;
}
