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 get() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
const int N = 2e5 + 5;
int n, m, _, w[N], node;
struct Edge {
  int v, nxt;
} edge[N];
int head[N], tot;
vector<int> adj[N];
int low[N], dfn[N], tim, st[N], tp;
int sze[N], son[N], seg[N], rev[N], top[N], dep[N], fa[N];
struct Heap {
  priority_queue<int, vector<int>, greater<int> > p, q;
  void maintain() {
    while (!q.empty() && p.top() == q.top()) p.pop(), q.pop();
  }
  void push(int x) { maintain(), p.push(x); }
  void pop(int x) { maintain(), q.push(x); }
  int top() {
    maintain();
    return p.top();
  }
} q[N];
void add(int u, int v) { edge[++tot] = {v, head[u]}, head[u] = tot; }
void tarjan(int u) {
  low[u] = dfn[u] = ++tim, st[++tp] = u;
  for (int i = head[u]; i; i = edge[i].nxt) {
    int v = edge[i].v;
    if (!dfn[v]) {
      tarjan(v), low[u] = min(low[u], low[v]);
      if (low[v] == dfn[u]) {
        ++node;
        for (int x = 0; x != v; tp--)
          x = st[tp], adj[x].push_back(node), adj[node].push_back(x);
        adj[u].push_back(node), adj[node].push_back(u);
      }
    } else
      low[u] = min(low[u], dfn[v]);
  }
}
void dfs(int u, int lst) {
  dep[u] = dep[lst] + 1, sze[u] = 1, fa[u] = lst;
  for (int i = 0; i < adj[u].size(); i++)
    if (adj[u][i] != lst)
      dfs(adj[u][i], u), sze[u] += sze[adj[u][i]],
          son[u] = sze[adj[u][i]] > sze[son[u]] ? adj[u][i] : son[u];
}
void df5(int u, int lst) {
  seg[++seg[0]] = u, rev[u] = seg[0], top[u] = lst;
  if (son[u]) df5(son[u], lst);
  for (int i = 0; i < adj[u].size(); i++)
    if (!top[adj[u][i]]) df5(adj[u][i], adj[u][i]);
}
namespace SegmentTree {
int mx[N << 2];
void pushup(int u) { mx[u] = min(mx[(u << 1)], mx[(u << 1 | 1)]); }
void build(int u, int l, int r) {
  mx[u] = 0x3f3f3f3f;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build((u << 1), l, mid), build((u << 1 | 1), mid + 1, r);
}
void update(int u, int l, int r, int x, int v) {
  if (l == r) return void(mx[u] = v);
  int mid = (l + r) >> 1;
  if (x <= mid)
    update((u << 1), l, mid, x, v);
  else
    update((u << 1 | 1), mid + 1, r, x, v);
  pushup(u);
}
int query(int u, int l, int r, int a, int b) {
  if (a == l && r == b) return mx[u];
  int mid = (l + r) >> 1;
  if (b <= mid)
    return query((u << 1), l, mid, a, b);
  else if (a > mid)
    return query((u << 1 | 1), mid + 1, r, a, b);
  else
    return min(query((u << 1), l, mid, a, mid),
               query((u << 1 | 1), mid + 1, r, mid + 1, b));
}
}  // namespace SegmentTree
int query(int x, int y) {
  int res = 0x3f3f3f3f;
  while (top[x] ^ top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    res = min(res, SegmentTree::query(1, 1, seg[0], rev[top[x]], rev[x])),
    x = fa[top[x]];
  }
  if (dep[x] > dep[y]) swap(x, y);
  res = min(res, SegmentTree::query(1, 1, seg[0], rev[x], rev[y]));
  if (x > n) res = min(res, w[fa[x]]);
  return res;
}
void update(int x, int y) {
  if (fa[x]) q[fa[x]].pop(w[x]);
  w[x] = y;
  if (fa[x]) q[fa[x]].push(w[x]);
  SegmentTree::update(1, 1, seg[0], rev[x], w[x]);
  if (fa[x]) SegmentTree::update(1, 1, seg[0], rev[fa[x]], q[fa[x]].top());
}
int main() {
  n = get(), m = get(), _ = get(), node = n;
  for (int i = 1; i <= n; i++) w[i] = get();
  for (int i = 1, u, v; i <= m; i++) u = get(), v = get(), add(u, v), add(v, u);
  tarjan(1);
  dfs(1, 0), df5(1, 1), SegmentTree::build(1, 1, seg[0]);
  for (int i = 1; i <= n; i++)
    if (fa[i] > n) q[fa[i]].push(w[i]);
  for (int i = 1; i <= node; i++)
    SegmentTree::update(1, 1, seg[0], rev[i], (i <= n) ? w[i] : q[i].top());
  for (int i = 1; i <= _; i++) {
    char opt;
    scanf("%s", &opt);
    int x = get(), y = get();
    if (opt == 'A') printf("%d\n", query(x, y));
    if (opt == 'C') update(x, y);
  }
  return 0;
}
