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 pre[1000005], to[1000005], las[1000005], inc;
int deg[1000005];
vector<int> T[1000005];
int dfn[1000005], low[1000005], st[1000005], tp, csq;
int n, m, q;
void ins(int a, int b) {
  pre[++inc] = las[a];
  las[a] = inc, to[inc] = b;
}
void Tarjan(int x) {
  dfn[x] = low[x] = ++dfn[0];
  st[++tp] = x;
  for (int i = las[x]; i; i = pre[i]) {
    int y = to[i];
    if (!dfn[y]) {
      Tarjan(y);
      low[x] = min(low[x], low[y]);
      if (dfn[x] == low[y]) {
        csq++;
        while (st[tp + 1] != y) {
          T[st[tp]].push_back(n + csq);
          T[n + csq].push_back(st[tp]);
          deg[st[tp]]++, deg[n + csq]++;
          tp--;
        }
        T[n + csq].push_back(x), T[x].push_back(n + csq);
        deg[n + csq]++, deg[x]++;
      }
    } else
      low[x] = min(low[x], dfn[y]);
  }
}
multiset<int> wson[1000005];
int in[1000005], top[1000005], hson[1000005], sz[1000005], par[1000005],
    dep[1000005];
int w[1000005], inv[1000005];
void FE(int x, int f) {
  par[x] = f, sz[x] = 1, dep[x] = dep[f] + 1;
  for (int i = 0; i < T[x].size(); i++) {
    int y = T[x][i];
    if (y == f) continue;
    FE(y, x), sz[x] += sz[y];
    if (sz[y] > sz[hson[x]]) hson[x] = y;
  }
}
void CE(int x, int anc) {
  top[x] = anc, in[x] = ++in[0], inv[in[0]] = x;
  if (hson[x]) CE(hson[x], anc);
  for (int i = 0; i < T[x].size(); i++) {
    int y = T[x][i];
    if (top[y]) continue;
    CE(y, y);
  }
}
int mn[1000005];
void Init(int p, int l, int r) {
  if (l == r) {
    if (inv[l] <= n)
      mn[p] = w[inv[l]];
    else
      mn[p] = *wson[inv[l]].begin();
    return;
  }
  int mid = (l + r) >> 1;
  Init(p << 1, l, mid), Init(p << 1 | 1, mid + 1, r);
  mn[p] = min(mn[p << 1], mn[p << 1 | 1]);
}
void Modify(int p, int l, int r, int x, int v) {
  if (l == r) return (void)(mn[p] = v);
  int mid = (l + r) >> 1;
  if (x <= mid)
    Modify(p << 1, l, mid, x, v);
  else
    Modify(p << 1 | 1, mid + 1, r, x, v);
  mn[p] = min(mn[p << 1], mn[p << 1 | 1]);
}
int Query(int p, int l, int r, int x, int y) {
  if (x <= l && r <= y) return mn[p];
  int mid = (l + r) >> 1, ret = 1e9;
  if (x <= mid && y >= l) ret = min(ret, Query(p << 1, l, mid, x, y));
  if (y > mid && x <= r) ret = min(ret, Query(p << 1 | 1, mid + 1, r, x, y));
  return ret;
}
int Ask(int x, int y) {
  int ret = 1e9;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    ret = min(ret, Query(1, 1, n + csq, in[top[x]], in[x]));
    x = par[top[x]];
  }
  if (dep[x] > dep[y]) swap(x, y);
  ret = min(ret, Query(1, 1, n + csq, in[x], in[y]));
  if (x > n) ret = min(ret, w[par[x]]);
  return ret;
}
void Change(int x, int y) {
  Modify(1, 1, n + csq, in[x], y);
  if (x != 1) {
    wson[par[x]].erase(wson[par[x]].find(w[x]));
    wson[par[x]].insert(y);
    Modify(1, 1, n + csq, in[par[x]], *wson[par[x]].begin());
  }
  w[x] = y;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1, u, v; i <= m; i++)
    scanf("%d%d", &u, &v), ins(u, v), ins(v, u);
  Tarjan(1);
  FE(1, 0), CE(1, 1);
  for (int i = n + 1; i <= n + csq; i++) {
    for (int j = 0; j < T[i].size(); j++) {
      int y = T[i][j];
      if (y == par[i]) continue;
      wson[i].insert(w[y]);
    }
  }
  Init(1, 1, n + csq);
  while (q--) {
    char op[3];
    int x, y;
    scanf("%s%d%d", op, &x, &y);
    if (op[0] == 'A')
      printf("%d\n", Ask(x, y));
    else
      Change(x, y);
  }
}
