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;
struct my_heap {
  priority_queue<int, vector<int>, greater<int> > p, q;
  void insert(int v) { p.push(v); }
  void del(int v) { q.push(v); }
  int top() {
    while (!q.empty() && p.top() == q.top()) {
      p.pop();
      q.pop();
    }
    return p.top();
  }
} h[200000 + 5];
int n, m, q;
int a[200000 + 5];
vector<int> G[200000 + 5], T[200000 + 5];
void add_edge(vector<int> *E, int u, int v) {
  E[u].push_back(v);
  E[v].push_back(u);
}
int cnt = 0;
namespace DCC {
int tim;
bool ins[200000 + 5];
int dfn[200000 + 5], low[200000 + 5];
stack<int> st;
void tarjan(int x) {
  st.push(x);
  ins[x] = 1;
  dfn[x] = low[x] = ++tim;
  for (int y : G[x]) {
    if (!dfn[y]) {
      tarjan(y);
      low[x] = min(low[x], low[y]);
      if (dfn[x] <= low[y]) {
        cnt++;
        int z;
        do {
          z = st.top();
          st.pop();
          ins[z] = 0;
          add_edge(T, z, cnt);
        } while (z != y);
        add_edge(T, x, cnt);
      }
    } else
      low[x] = min(low[x], dfn[y]);
  }
}
void ini() {
  cnt = n;
  for (int i = 1; i <= n; i++) {
    if (!dfn[i]) tarjan(i);
  }
}
}  // namespace DCC
namespace HLD {
struct segment_tree {
  struct node {
    int l;
    int r;
    int v;
  } tree[200000 * 4 + 5];
  void push_up(int pos) {
    tree[pos].v = min(tree[pos << 1].v, tree[pos << 1 | 1].v);
  }
  void build(int l, int r, int pos) {
    tree[pos].l = l;
    tree[pos].r = r;
    tree[pos].v = 0x3f3f3f3f;
    if (l == r) return;
    int mid = (l + r) >> 1;
    build(l, mid, pos << 1);
    build(mid + 1, r, pos << 1 | 1);
    push_up(pos);
  }
  void update(int upos, int uval, int pos) {
    if (tree[pos].l == tree[pos].r) {
      tree[pos].v = uval;
      return;
    }
    int mid = (tree[pos].l + tree[pos].r) >> 1;
    if (upos <= mid)
      update(upos, uval, pos << 1);
    else
      update(upos, uval, pos << 1 | 1);
    push_up(pos);
  }
  int query(int L, int R, int pos) {
    if (L <= tree[pos].l && R >= tree[pos].r) return tree[pos].v;
    int mid = (tree[pos].l + tree[pos].r) >> 1;
    int ans = 0x3f3f3f3f;
    if (L <= mid) ans = min(ans, query(L, R, pos << 1));
    if (R > mid) ans = min(ans, query(L, R, pos << 1 | 1));
    return ans;
  }
} Tr;
int tim;
int fa[200000 + 5], sz[200000 + 5], son[200000 + 5], top[200000 + 5],
    dfn[200000 + 5], deep[200000 + 5];
void dfs1(int x, int f) {
  fa[x] = f;
  sz[x] = 1;
  deep[x] = deep[f] + 1;
  for (int y : T[x]) {
    if (y != f) {
      dfs1(y, x);
      sz[x] += sz[y];
      if (sz[y] > sz[son[x]]) son[x] = y;
    }
  }
}
void dfs2(int x, int t) {
  top[x] = t;
  dfn[x] = ++tim;
  if (son[x]) dfs2(son[x], t);
  for (int y : T[x]) {
    if (y != fa[x] && y != son[x]) {
      dfs2(y, y);
    }
  }
}
void ini() {
  dfs1(1, 0);
  dfs2(1, 1);
  Tr.build(1, cnt, 1);
  for (int i = 1; i <= n; i++) {
    if (fa[i]) h[fa[i]].insert(a[i]);
  }
  for (int i = 1; i <= cnt; i++) {
    if (i <= n)
      Tr.update(dfn[i], a[i], 1);
    else
      Tr.update(dfn[i], h[i].top(), 1);
  }
}
void change(int x, int val) {
  int tmp = a[x];
  a[x] = val;
  Tr.update(dfn[x], val, 1);
  if (fa[x]) {
    h[fa[x]].del(tmp);
    h[fa[x]].insert(val);
    Tr.update(dfn[fa[x]], h[fa[x]].top(), 1);
  }
}
int query(int x, int y) {
  int ans = 0x3f3f3f3f;
  while (top[x] != top[y]) {
    if (deep[top[x]] < deep[top[y]]) {
      swap(x, y);
    }
    ans = min(ans, Tr.query(dfn[top[x]], dfn[x], 1));
    x = fa[top[x]];
  }
  if (deep[x] > deep[y]) swap(x, y);
  ans = min(ans, Tr.query(dfn[x], dfn[y], 1));
  if (x > n) ans = min(ans, a[fa[x]]);
  return ans;
}
}  // namespace HLD
int main() {
  int u, v;
  char ch[2];
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &u, &v);
    add_edge(G, u, v);
  }
  DCC::ini();
  HLD::ini();
  for (int i = 1; i <= q; i++) {
    scanf("%s %d %d", ch, &u, &v);
    if (ch[0] == 'A')
      printf("%d\n", HLD::query(u, v));
    else
      HLD::change(u, v);
  }
}
