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 n, m, q, top, Index, cnt, low[300005], dfn[300005], sta[300005], a[300005],
    fa[300005], seg[300005], Top[300005], rev[300005], son[300005],
    size[300005], dep[300005];
vector<int> G[300005], NewG[300005];
multiset<int> S[300005];
void Add(int u, int v) {
  NewG[u].push_back(v);
  NewG[v].push_back(u);
}
void tarjan(int u, int fa) {
  low[u] = dfn[u] = ++Index;
  sta[++top] = u;
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (!dfn[v]) {
      tarjan(v, u);
      low[u] = min(low[u], low[v]);
      if (low[v] >= dfn[u]) {
        cnt++;
        Add(cnt, u);
        int now;
        do {
          Add(cnt, now = sta[top--]);
        } while (now != v);
      }
    } else if (v != fa)
      low[u] = min(low[u], dfn[v]);
  }
}
struct SGT {
  int minn[1200005];
  void build(int x, int l, int r) {
    if (l == r) {
      minn[x] = a[rev[l]];
      return;
    }
    int mid = (l + r) >> 1;
    build(x << 1, l, mid);
    build(x << 1 | 1, mid + 1, r);
    minn[x] = min(minn[x << 1], minn[x << 1 | 1]);
  }
  void Change(int x, int l, int r, int a, int b) {
    if (l == r && l == a) {
      minn[x] = b;
      return;
    }
    int mid = (l + r) >> 1;
    if (a <= mid)
      Change(x << 1, l, mid, a, b);
    else
      Change(x << 1 | 1, mid + 1, r, a, b);
    minn[x] = min(minn[x << 1], minn[x << 1 | 1]);
  }
  int askmin(int x, int l, int r, int L, int R) {
    if (L <= l && r <= R) return minn[x];
    int res = 2e9;
    int mid = (l + r) >> 1;
    if (L <= mid) res = min(res, askmin(x << 1, l, mid, L, R));
    if (mid + 1 <= R) res = min(res, askmin(x << 1 | 1, mid + 1, r, L, R));
    return res;
  }
} T;
void change(int u, int v) {
  int U = fa[u];
  if (U > n) {
    S[U].erase(S[U].find(a[u]));
    S[U].insert(v);
    a[U] = *S[U].begin();
    T.Change(1, 1, seg[0], seg[U], a[U]);
  }
  a[u] = v;
  T.Change(1, 1, seg[0], seg[u], a[u]);
}
int query(int u, int v) {
  int fu = Top[u], fv = Top[v];
  int ans = 2e9;
  while (fu != fv) {
    if (dep[fu] >= dep[fv])
      ans = min(ans, T.askmin(1, 1, seg[0], seg[fu], seg[u])), u = fa[fu];
    else
      ans = min(ans, T.askmin(1, 1, seg[0], seg[fv], seg[v])), v = fa[fv];
    fu = Top[u], fv = Top[v];
  }
  if (dep[u] < dep[v]) {
    ans = min(ans, T.askmin(1, 1, seg[0], seg[u], seg[v]));
    if (u > n && fa[u]) ans = min(ans, a[fa[u]]);
  } else {
    ans = min(ans, T.askmin(1, 1, seg[0], seg[v], seg[u]));
    if (v > n && fa[v]) ans = min(ans, a[fa[v]]);
  }
  return ans;
}
void dfs1(int u, int f) {
  fa[u] = f, size[u] = 1;
  dep[u] = dep[f] + 1;
  for (int i = 0; i < NewG[u].size(); i++) {
    int v = NewG[u][i];
    if (v == f) continue;
    dfs1(v, u);
    if (u > n) S[u].insert(a[v]);
    size[u] += size[v];
    if (size[v] > size[son[u]]) son[u] = v;
  }
  if (u > n) a[u] = *S[u].begin();
}
void dfs2(int u, int f) {
  if (son[u]) {
    seg[son[u]] = ++seg[0];
    rev[seg[0]] = son[u];
    Top[son[u]] = Top[u];
    dfs2(son[u], u);
  }
  for (int i = 0; i < NewG[u].size(); i++) {
    int v = NewG[u][i];
    if (v == f || v == son[u]) continue;
    seg[v] = ++seg[0];
    rev[seg[0]] = v;
    Top[v] = v;
    dfs2(v, u);
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &q);
  cnt = n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  tarjan(1, 0);
  dfs1(1, 0);
  seg[0] = seg[1] = 1, rev[1] = Top[1] = 1;
  dfs2(1, 0);
  T.build(1, 1, seg[0]);
  while (q--) {
    int u, v;
    char s[5];
    scanf("%s %d %d", s, &u, &v);
    if (s[0] == 'A')
      printf("%d\n", query(u, v));
    else
      change(u, v);
  }
  return 0;
}
