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>
using namespace std;
bool vis[400010];
multiset<int> q[400010];
int tot = 1, t, n, m, cnt, TOT, Top, Q;
int dep[400010], son[400010], siz[400010], head[400010];
int zhan[400010], dfn[400010], low[400010], minx[400010];
int a[400010], fa[400010], top[400010], Head[400010], pre[400010];
struct edge {
  int fr, to, nxt;
} e[400010], E[400010];
int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 1) + (s << 3) + ch - '0', ch = getchar();
  return s * w;
}
void add(int fr, int to) {
  e[++tot] = (edge){fr, to, head[fr]};
  head[fr] = tot;
}
void Add(int fr, int to) {
  E[++TOT] = (edge){fr, to, Head[fr]};
  Head[fr] = TOT;
}
void tarjan(int u) {
  zhan[++Top] = u;
  dfn[u] = low[u] = ++cnt;
  for (int i = head[u]; i; i = e[i].nxt) {
    int to = e[i].to;
    if (!dfn[to]) {
      tarjan(to);
      low[u] = min(low[u], low[to]);
      if (low[to] >= dfn[u]) {
        ++t;
        int pre;
        do {
          pre = zhan[Top--];
          Add(pre, t);
          Add(t, pre);
        } while (pre != to);
        Add(t, u);
        Add(u, t);
      }
    } else
      low[u] = min(low[u], dfn[to]);
  }
}
namespace Seg {
void pushup(int x) { minx[x] = min(minx[x << 1], minx[x << 1 | 1]); }
void build(int x, int l, int r) {
  if (l == r) {
    if (pre[l] <= n)
      minx[x] = a[pre[l]];
    else
      minx[x] = *q[pre[l]].begin();
    return;
  }
  int mid = l + r >> 1;
  build(x << 1, l, mid);
  build(x << 1 | 1, mid + 1, r);
  pushup(x);
}
void update(int x, int l, int r, int pos, int val) {
  if (l == r) {
    minx[x] = val;
    return;
  }
  int mid = l + r >> 1;
  if (pos <= mid)
    update(x << 1, l, mid, pos, val);
  else
    update(x << 1 | 1, mid + 1, r, pos, val);
  pushup(x);
}
int query(int x, int l, int r, int L, int R) {
  if (L <= l && R >= r) return minx[x];
  int mid = l + r >> 1, ans = 0x3f3f3f3f;
  if (L <= mid) ans = min(ans, query(x << 1, l, mid, L, R));
  if (R >= mid + 1) ans = min(ans, query(x << 1 | 1, mid + 1, r, L, R));
  return ans;
}
}  // namespace Seg
namespace Cut {
void dfs1(int u, int fat) {
  dep[u] = dep[fat] + 1;
  fa[u] = fat;
  siz[u] = 1;
  q[fat].insert(a[u]);
  for (int i = Head[u]; i; i = E[i].nxt) {
    int to = E[i].to;
    if (to == fat) continue;
    dfs1(to, u);
    siz[u] += siz[to];
    if (siz[son[u]] < siz[to]) son[u] = to;
  }
}
void dfs2(int u, int tp) {
  top[u] = tp;
  dfn[u] = ++cnt;
  pre[cnt] = u;
  if (son[u]) dfs2(son[u], tp);
  for (int i = Head[u]; i; i = E[i].nxt) {
    int to = E[i].to;
    if (to == fa[u] || to == son[u]) continue;
    dfs2(to, to);
  }
}
int getmin(int x, int y) {
  int ans = 0x3f3f3f3f;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    ans = min(ans, Seg::query(1, 1, t, dfn[top[x]], dfn[x]));
    x = fa[top[x]];
  }
  if (dfn[x] > dfn[y]) swap(x, y);
  ans = min(ans, Seg::query(1, 1, t, dfn[x], dfn[y]));
  if (x > n) ans = min(ans, a[fa[x]]);
  return ans;
}
}  // namespace Cut
int main() {
  n = read();
  m = read();
  Q = read();
  t = n;
  a[0] = 0x3f3f3f3f;
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1, fr, to; i <= m; i++)
    fr = read(), to = read(), add(fr, to), add(to, fr);
  tarjan(1);
  cnt = 0;
  memset(dfn, 0, sizeof dfn);
  Cut::dfs1(1, 0);
  Cut::dfs2(1, 1);
  Seg::build(1, 1, t);
  for (int i = 1, x, y; i <= Q; i++) {
    char opt;
    scanf("%c", &opt);
    x = read();
    y = read();
    if (opt == 'C') {
      q[fa[x]].erase(q[fa[x]].find(a[x]));
      q[fa[x]].insert(y);
      a[x] = y;
      Seg::update(1, 1, t, dfn[x], y);
      Seg::update(1, 1, t, dfn[fa[x]], *q[fa[x]].begin());
    } else
      printf("%d\n", Cut::getmin(x, y));
  }
  return 0;
}