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 gi() {
  char ch = '!';
  int res = 0, f = 0;
  while (ch < '0' || ch > '9') {
    ch = getchar();
    if (ch == '-') f = 1;
  }
  while (ch >= '0' && ch <= '9') res = res * 10 + ch - '0', ch = getchar();
  return f ? -res : res;
}
const int N = 4e5 + 100;
int n, m, cnt, Q, w[N], stk[N], top, low[N], dfn[N], ind[N], Time, dep[N],
    fa[N], bel[N], son[N], sz[N], mn[N << 2];
priority_queue<int, vector<int>, greater<int> > Q1[N], Q2[N];
int head[N], ce;
struct edge {
  int to, nxt;
} e[N << 1];
vector<int> nxt[N];
void lnk(int a, int b) { e[++ce] = (edge){b, head[a]}, head[a] = ce; }
void tarjan(int u) {
  dfn[u] = low[u] = ++Time, stk[++top] = u;
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].to;
    if (!dfn[v]) {
      tarjan(v), low[u] = min(low[u], low[v]);
      if (low[v] == dfn[u]) {
        ++cnt, nxt[cnt].push_back(u), nxt[u].push_back(cnt);
        do {
          nxt[stk[top]].push_back(cnt);
          nxt[cnt].push_back(stk[top]);
        } while (stk[top--] != v);
      }
    } else
      low[u] = min(low[u], dfn[v]);
  }
}
void dfs1(int u, int lst) {
  dep[u] = dep[fa[u]] + 1, sz[u] = 1;
  for (auto v : nxt[u])
    if (v != lst) {
      if (u > n) Q1[u].push(w[v]);
      fa[v] = u, dfs1(v, u), sz[u] += sz[v];
      son[u] = sz[son[u]] > sz[v] ? son[u] : v;
    }
}
void dfs2(int u, int lst) {
  bel[u] = son[lst] == u ? bel[lst] : u;
  dfn[u] = ++Time, ind[Time] = u;
  if (son[u]) dfs2(son[u], u);
  for (auto v : nxt[u])
    if (v != son[u] && v != lst) dfs2(v, u);
}
void init(int k = 1, int l = 1, int r = cnt) {
  if (l == r) {
    if (ind[l] <= n)
      mn[k] = w[ind[l]];
    else
      mn[k] = Q1[ind[l]].top();
    return;
  }
  int mid = (l + r) >> 1;
  init((k << 1), l, mid), init((k << 1 | 1), mid + 1, r);
  mn[k] = min(mn[(k << 1)], mn[(k << 1 | 1)]);
}
void modify(int k, int tar, int val, int l = 1, int r = cnt) {
  if (l == r) return (void)(mn[k] = val);
  int mid = (l + r) >> 1;
  tar <= mid ? modify((k << 1), tar, val, l, mid)
             : modify((k << 1 | 1), tar, val, mid + 1, r);
  mn[k] = min(mn[(k << 1)], mn[(k << 1 | 1)]);
}
int query(int k, int ql, int qr, int l = 1, int r = cnt) {
  if (ql <= l && r <= qr) return mn[k];
  int mid = (l + r) >> 1, res = 1e9;
  if (ql <= mid) res = query((k << 1), ql, qr, l, mid);
  if (qr > mid) res = min(res, query((k << 1 | 1), ql, qr, mid + 1, r));
  return res;
}
int Query(int x, int y) {
  int res = 1e9;
  while (bel[x] != bel[y]) {
    if (dep[bel[x]] < dep[bel[y]]) swap(x, y);
    res = min(res, query(1, dfn[bel[x]], dfn[x]));
    x = fa[bel[x]];
  }
  if (dep[x] > dep[y]) swap(x, y);
  res = min(res, query(1, dfn[x], dfn[y]));
  if (x > n) res = min(res, w[fa[x]]);
  return res;
}
int main() {
  cnt = n = gi(), m = gi(), Q = gi();
  for (int i = 1; i <= n; ++i) w[i] = gi();
  for (int i = 1; i <= m; ++i) {
    int x = gi(), y = gi();
    lnk(x, y), lnk(y, x);
  }
  tarjan(1);
  Time = 0;
  dfs1(1, 0), dfs2(1, 0), init();
  while (Q--) {
    char op = '!';
    while (op != 'A' && op != 'C') op = getchar();
    int a = gi(), b = gi();
    if (op == 'C') {
      if (fa[a]) {
        Q2[fa[a]].push(w[a]), Q1[fa[a]].push(b);
        while (!Q2[fa[a]].empty() && Q2[fa[a]].top() == Q1[fa[a]].top())
          Q2[fa[a]].pop(), Q1[fa[a]].pop();
        modify(1, dfn[fa[a]], Q1[fa[a]].top());
      }
      modify(1, dfn[a], w[a] = b);
    } else
      printf("%d\n", Query(a, b));
  }
  return 0;
}
