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;
const int N = 4e5 + 10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
int h[N], e[N], ne[N], idx;
int dfn[N], ins[N], low[N], w[N], times;
int depth[N], fa[N], id[N], top[N], son[N], sz[N];
stack<int> st;
vector<int> g[N];
multiset<int> m1[N];
int vis[N];
int cnt;
int n, m;
struct node {
  int l, r;
  long long mi;
} tr[N << 2];
void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; }
void tarjan(int u) {
  ins[u] = 1;
  dfn[u] = low[u] = ++times;
  int i;
  st.push(u);
  for (int i = h[u]; i != -1; i = ne[i]) {
    int v = e[i];
    if (!dfn[v]) {
      fa[v] = u;
      tarjan(v);
      low[u] = min(low[u], low[v]);
      if (dfn[u] <= low[v]) {
        ++cnt;
        while (1) {
          auto x = st.top();
          g[cnt].push_back(x);
          g[x].push_back(cnt);
          ins[x] = 0;
          st.pop();
          if (x == v) break;
        }
        g[cnt].push_back(u);
        g[u].push_back(cnt);
      }
    } else if (v != fa[u]) {
      low[u] = min(low[u], dfn[v]);
    }
  }
}
void dfs1(int u, int ff) {
  int i;
  sz[u] = 1;
  vis[u] = 1;
  for (i = 0; i < (int)g[u].size(); i++) {
    int j = g[u][i];
    if (vis[j]) continue;
    depth[j] = depth[u] + 1;
    fa[j] = u;
    dfs1(j, u);
    sz[u] += sz[j];
    if (sz[j] > sz[son[u]]) {
      son[u] = j;
    }
  }
}
void dfs2(int u, int x) {
  vis[u] = 1;
  top[u] = x;
  dfn[u] = ++times;
  id[times] = u;
  if (!son[u]) return;
  dfs2(son[u], x);
  int i;
  for (i = 0; i < (int)g[u].size(); i++) {
    int j = g[u][i];
    if (vis[j]) continue;
    dfs2(j, j);
  }
}
void pushup(int u) { tr[u].mi = min(tr[u << 1].mi, tr[u << 1 | 1].mi); }
void build(int u, int l, int r) {
  if (l == r) {
    tr[u] = {l, r, w[id[l]]};
  } else {
    tr[u] = {l, r};
    int mid = l + r >> 1;
    build(u << 1, l, mid);
    build(u << 1 | 1, mid + 1, r);
    pushup(u);
  }
}
void modify(int u, int l, int x) {
  if (tr[u].l == tr[u].r) {
    tr[u].mi = x;
    return;
  }
  int mid = tr[u].l + tr[u].r >> 1;
  if (l <= mid)
    modify(u << 1, l, x);
  else
    modify(u << 1 | 1, l, x);
  pushup(u);
}
int query(int u, int l, int r) {
  if (tr[u].l >= l && tr[u].r <= r) {
    return tr[u].mi;
  }
  int mid = tr[u].r + tr[u].l >> 1;
  int res = inf;
  if (l <= mid) res = query(u << 1, l, r);
  if (r > mid) res = min(res, query(u << 1 | 1, l, r));
  return res;
}
int pathquery(int x, int y) {
  int res = inf;
  while (top[x] != top[y]) {
    if (depth[top[x]] < depth[top[y]]) swap(x, y);
    res = min(res, query(1, dfn[top[x]], dfn[x]));
    x = fa[top[x]];
  }
  if (depth[x] > depth[y]) swap(x, y);
  res = min(res, query(1, dfn[x], dfn[y]));
  if (x > n) {
    res = min(res, w[fa[x]]);
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  int i, j, q;
  cin >> n >> m >> q;
  memset(h, -1, sizeof h);
  cnt = n;
  for (i = 1; i <= n; i++) cin >> w[i];
  for (i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    add(a, b);
    add(b, a);
  }
  tarjan(1);
  times = 0;
  depth[1] = 1;
  dfs1(1, 0);
  memset(vis, 0, sizeof vis);
  dfs2(1, 1);
  for (i = 2; i <= n; i++) {
    m1[fa[i] - n].insert(w[i]);
  }
  for (i = n + 1; i <= cnt; i++) {
    w[i] = (m1[i - n].empty()) ? inf : *m1[i - n].begin();
  }
  build(1, 1, cnt);
  while (q--) {
    string opt;
    cin >> opt;
    if (opt == "C") {
      int x, tmp;
      cin >> x >> tmp;
      modify(1, dfn[x], tmp);
      if (x == 1) {
        w[x] = tmp;
        continue;
      }
      m1[fa[x] - n].erase(m1[fa[x] - n].lower_bound(w[x]));
      m1[fa[x] - n].insert(tmp);
      w[x] = tmp;
      if (*m1[fa[x] - n].begin() == w[fa[x]]) {
        continue;
      }
      int pos = *m1[fa[x] - n].begin();
      w[fa[x]] = pos;
      modify(1, dfn[fa[x]], pos);
    } else {
      int a, b;
      cin >> a >> b;
      cout << pathquery(a, b) << endl;
    }
  }
}
