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 MAXN = 2e5 + 3;
int inde, ncnt, n, m, q, w[MAXN], dfn[MAXN], low[MAXN], dep[MAXN], belong[MAXN],
    fa[MAXN], top[MAXN], siz[MAXN], son[MAXN], fd[MAXN];
vector<int> G[MAXN];
vector<int> G1[MAXN];
int sta[MAXN], tail;
bool flag[MAXN];
multiset<int> se[MAXN];
struct node {
  int l, r, minn;
} tre[MAXN << 2];
void dfs(int x, int f) {
  dfn[x] = low[x] = ++inde, sta[++tail] = x;
  for (int i = 0; i < G[x].size(); i++) {
    int v = G[x][i];
    if (v == f) continue;
    if (dfn[v])
      low[x] = min(low[x], dfn[v]);
    else {
      dfs(v, x);
      if (dfn[x] <= low[v]) {
        int tx;
        ncnt++;
        do {
          tx = sta[tail];
          tail--;
          belong[tx] = ncnt;
          G1[tx].push_back(ncnt);
          G1[ncnt].push_back(tx);
        } while (tx != v);
        G1[x].push_back(ncnt);
        G1[ncnt].push_back(x);
      }
      low[x] = min(low[v], low[x]);
    }
  }
}
void dfs1(int x, int f) {
  siz[x] = 1;
  for (int i = 0; i < G1[x].size(); i++) {
    int v = G1[x][i];
    if (v == f) continue;
    dep[v] = dep[x] + 1;
    fa[v] = x;
    dfs1(v, x);
    siz[x] += siz[v];
    if (!son[x] || siz[son[x]] < siz[v]) son[x] = v;
  }
}
void dfs2(int x, int f) {
  top[x] = f;
  dfn[x] = ++inde;
  fd[inde] = x;
  if (!son[x]) return;
  dfs2(son[x], f);
  for (int i = 0; i < G1[x].size(); i++) {
    int v = G1[x][i];
    if (v == fa[x] || v == son[x]) continue;
    dfs2(v, v);
  }
}
void build(int i, int l, int r) {
  tre[i].l = l, tre[i].r = r;
  if (l == r) {
    tre[i].minn = w[fd[l]];
    return;
  }
  int mid = l + r >> 1;
  build(i << 1, l, mid);
  build(i << 1 | 1, mid + 1, r);
  tre[i].minn = min(tre[i << 1].minn, tre[i << 1 | 1].minn);
}
void modify(int i, int l, int r, int delta) {
  if (tre[i].l > r || tre[i].r < l) return;
  if (tre[i].l == tre[i].r && tre[i].l == l) {
    tre[i].minn = delta;
    return;
  }
  modify(i << 1, l, r, delta);
  modify(i << 1 | 1, l, r, delta);
  tre[i].minn = min(tre[i << 1].minn, tre[i << 1 | 1].minn);
}
int query(int i, int l, int r) {
  if (tre[i].l > r || tre[i].r < l) return 1e9 + 3;
  if (tre[i].l >= l && tre[i].r <= r) {
    return tre[i].minn;
  }
  int ans = query(i << 1, l, r);
  ans = min(query(i << 1 | 1, l, r), ans);
  return ans;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    G[x].push_back(y);
    G[y].push_back(x);
  }
  ncnt = n;
  dfs(1, 0);
  dep[1] = 1;
  dfs1(1, 0);
  memset(dfn, 0, sizeof(dfn));
  inde = 0;
  for (int i = n + 1; i <= ncnt; i++) {
    for (int j = 0; j < G1[i].size(); j++) {
      int v = G1[i][j];
      if (fa[v] == i) {
        se[i].insert(w[v]);
      }
    }
    w[i] = (*se[i].begin());
  }
  dfs2(1, 1);
  build(1, 1, ncnt);
  while (q--) {
    char s[3];
    int x, y;
    scanf("%s", s);
    scanf("%d%d", &x, &y);
    if (s[0] == 'C') {
      int f = fa[x];
      if (f) {
        set<int>::iterator it = se[f].find(w[x]);
        se[f].erase(it);
        w[x] = y;
        se[f].insert(w[x]);
        w[f] = (*se[f].begin());
        modify(1, dfn[f], dfn[f], w[f]);
      } else
        w[x] = y;
      modify(1, dfn[x], dfn[x], w[x]);
    } else {
      int ans = 1e9 + 4;
      while (top[x] != top[y]) {
        if (dep[top[x]] < dep[top[y]]) swap(x, y);
        ans = min(ans, query(1, dfn[top[x]], dfn[x]));
        x = fa[top[x]];
      }
      if (dep[x] < dep[y]) swap(x, y);
      ans = min(ans, query(1, dfn[y], dfn[x]));
      if (y > n) ans = min(ans, query(1, dfn[fa[y]], dfn[fa[y]]));
      printf("%d\n", ans);
    }
  }
  return 0;
}
