Problem: 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>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
const int maxn = 2e5 + 1e2;
std::vector<int> T[maxn], G[maxn];
int n, m, q, w[maxn];
int dfn[maxn], low[maxn], ncr, dfc, stk[maxn], top;
void tarjan(int u) {
  low[u] = dfn[u] = ++dfc, stk[++top] = u;
  for (int v : G[u])
    if (!dfn[v]) {
      tarjan(v), low[u] = std::min(low[u], low[v]);
      if (low[v] == dfn[u]) {
        ++ncr;
        for (int x = 0; x != v; --top) {
          x = stk[top], T[ncr].push_back(x), T[x].push_back(ncr);
        }
        T[ncr].push_back(u), T[u].push_back(ncr);
      }
    } else
      low[u] = std::min(low[u], dfn[v]);
}
std::multiset<int> s[maxn];
int tree[maxn << 2];
void update(int x, int l, int r, int pos, int k) {
  if (l == r) {
    tree[x] = k;
    return;
  }
  int mid = (l + r) >> 1;
  if (pos <= mid)
    update(x << 1, l, mid, pos, k);
  else
    update(x << 1 | 1, mid + 1, r, pos, k);
  tree[x] = std::min(tree[x << 1], tree[x << 1 | 1]);
}
int query(int x, int l, int r, int ll, int rr) {
  if (ll <= l && r <= rr) return tree[x];
  int mid = (l + r) >> 1, res = 1e9;
  if (ll <= mid) res = std::min(res, query(x << 1, l, mid, ll, rr));
  if (rr > mid) res = std::min(res, query(x << 1 | 1, mid + 1, r, ll, rr));
  return res;
}
int sze[maxn], son[maxn], fat[maxn], dep[maxn];
void DFS1(int u, int fa) {
  fat[u] = fa, sze[u] = 1, dep[u] = dep[fa] + 1;
  for (int v : T[u])
    if (v != fa) {
      DFS1(v, u), sze[u] += sze[v];
      if (sze[son[u]] < sze[v]) son[u] = v;
    }
}
int dft[maxn], ttp[maxn], cnt;
void DFS2(int u, int tp) {
  ttp[u] = tp, dft[u] = ++cnt;
  if (son[u]) DFS2(son[u], tp);
  for (int v : T[u])
    if (v != fat[u] && v != son[u]) DFS2(v, v);
}
inline void init() {
  memset(tree, 63, sizeof tree), std::cin >> n >> m >> q, ncr = n;
  for (int i = 1; i <= n; i++) std::cin >> w[i];
  for (int i = 1, u, v; i <= m; i++)
    std::cin >> u >> v, G[u].push_back(v), G[v].push_back(u);
  tarjan(1), DFS1(1, 0), DFS2(1, 1);
  for (int i = 1; i <= n; i++)
    if (fat[i] && i <= n) s[fat[i]].insert(w[i]);
  for (int i = 1; i <= n; i++) update(1, 1, ncr, dft[i], w[i]);
  for (int i = n + 1; i <= ncr; i++) update(1, 1, ncr, dft[i], *s[i].begin());
}
inline void Modify(int x, int y) {
  if (fat[x])
    s[fat[x]].erase(s[fat[x]].find(w[x])), s[fat[x]].insert(y),
        update(1, 1, ncr, dft[fat[x]], *s[fat[x]].begin());
  w[x] = y, update(1, 1, ncr, dft[x], y);
}
inline int Query(int x, int y) {
  int res = 1e9 + 1e2;
  while (ttp[x] != ttp[y]) {
    if (dep[ttp[x]] < dep[ttp[y]]) std::swap(x, y);
    res = std::min(res, query(1, 1, ncr, dft[ttp[x]], dft[x])), x = fat[ttp[x]];
  }
  if (dep[x] < dep[y]) std::swap(x, y);
  res = std::min(res, query(1, 1, ncr, dft[y], dft[x]));
  if (y > n) res = std::min(res, w[fat[y]]);
  return res;
}
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
  init();
  while (q--) {
    char op;
    int a, b;
    std::cin >> op >> a >> b;
    if (op == 'C')
      Modify(a, b);
    else
      std::cout << Query(a, b) << std::endl;
  }
  return 0;
}