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;
namespace Dango {
const int MAXN = 100005, INF = 0x3f3f3f3f;
struct tree {
  int l, r, data;
} t[MAXN << 3];
vector<int> e[MAXN << 1];
multiset<int> val[MAXN];
int n, m, q, w[MAXN << 1];
int head[MAXN], to[MAXN << 1], nxt[MAXN << 1];
int dfn[MAXN], low[MAXN], bcc;
int size[MAXN << 1], maxson[MAXN << 1];
int fa[MAXN << 1], belong[MAXN << 1], d[MAXN << 1];
int id[MAXN << 1], link[MAXN << 1];
int read() {
  int x = 0, f = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    f |= (ch == '-');
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return f ? -x : x;
}
void add(int u, int v) {
  static int cnt;
  cnt++;
  to[cnt] = v;
  nxt[cnt] = head[u];
  head[u] = cnt;
}
void Tarjan(int u) {
  static int dfs_clock, cnt = n;
  static int st[MAXN], top;
  dfn[u] = low[u] = ++dfs_clock;
  st[++top] = u;
  for (int i = head[u]; i; i = nxt[i]) {
    int v = to[i];
    if (!dfn[v]) {
      Tarjan(v);
      low[u] = min(low[u], low[v]);
      if (low[v] == dfn[u]) {
        int x = 0;
        cnt++;
        bcc++;
        w[cnt] = INF;
        do {
          x = st[top--];
          w[cnt] = min(w[cnt], w[x]);
          val[bcc].insert(w[x]);
          e[x].push_back(cnt);
          e[cnt].push_back(x);
        } while (x != v);
        e[u].push_back(cnt);
        e[cnt].push_back(u);
      }
    } else
      low[u] = min(low[u], dfn[v]);
  }
}
void dfs(int u, int f) {
  fa[u] = f;
  d[u] = d[f] + 1;
  size[u] = 1;
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    if (v == f) continue;
    dfs(v, u);
    size[u] += size[v];
    if (size[maxson[u]] < size[v]) maxson[u] = v;
  }
}
void dfs(int u, int f, int anc) {
  static int cnt;
  cnt++;
  id[u] = cnt;
  link[cnt] = u;
  belong[u] = anc;
  if (maxson[u]) dfs(maxson[u], u, anc);
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    if (v == f || v == maxson[u]) continue;
    dfs(v, u, v);
  }
}
void build(int a, int l, int r) {
  t[a].l = l;
  t[a].r = r;
  if (l == r) {
    t[a].data = w[link[l]];
    return;
  }
  int mid = (l + r) >> 1;
  build(a << 1, l, mid);
  build(a << 1 | 1, mid + 1, r);
  t[a].data = min(t[a << 1].data, t[a << 1 | 1].data);
}
void update(int a, int pos, int data) {
  if (t[a].l == t[a].r) {
    t[a].data = data;
    return;
  }
  int mid = (t[a].l + t[a].r) >> 1;
  pos <= mid ? update(a << 1, pos, data) : update(a << 1 | 1, pos, data);
  t[a].data = min(t[a << 1].data, t[a << 1 | 1].data);
}
int query(int a, int l, int r) {
  if (t[a].l >= l && t[a].r <= r) return t[a].data;
  int mid = (t[a].l + t[a].r) >> 1, res = INF;
  if (l <= mid) res = min(res, query(a << 1, l, r));
  if (r > mid) res = min(res, query(a << 1 | 1, l, r));
  return res;
}
int getans(int u, int v) {
  int res = INF;
  while (belong[u] != belong[v]) {
    if (d[belong[u]] < d[belong[v]]) swap(u, v);
    res = min(res, query(1, id[belong[u]], id[u]));
    u = fa[belong[u]];
  }
  if (d[u] > d[v]) swap(u, v);
  res = min(res, query(1, id[u], id[v]));
  if (u > n) res = min(res, w[fa[u]]);
  return res;
}
int work() {
  n = read();
  m = read();
  q = read();
  for (int i = 1; i <= n; i++) w[i] = read();
  for (int i = 1; i <= m; i++) {
    int u = read(), v = read();
    add(u, v);
    add(v, u);
  }
  Tarjan(1);
  dfs(1, 0);
  dfs(1, 0, 1);
  build(1, 1, n + bcc);
  for (int i = 1; i <= q; i++) {
    char opt[3];
    scanf("%s", opt);
    int a = read(), b = read();
    if (opt[0] == 'C') {
      update(1, id[a], b);
      if (fa[a]) {
        int x = fa[a] - n;
        multiset<int>::iterator it = val[x].lower_bound(w[a]);
        val[x].erase(it);
        val[x].insert(b);
        it = val[x].begin();
        if ((*it) != w[fa[a]]) {
          update(1, id[fa[a]], *it);
          w[fa[a]] = *it;
        }
      }
      w[a] = b;
    } else
      printf("%d\n", getans(a, b));
  }
  return 0;
}
}  // namespace Dango
int main() { return Dango::work(); }
