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;
template <class T>
inline void cmin(T &a, T b) {
  ((a > b) && (a = b));
}
template <class T>
inline void cmax(T &a, T b) {
  ((a < b) && (a = b));
}
char IO;
int rd() {
  int s = 0, f = 0;
  while (!isdigit(IO = getchar()))
    if (IO == '-') f = 1;
  do s = (s << 1) + (s << 3) + (IO ^ '0');
  while (isdigit(IO = getchar()));
  return f ? -s : s;
}
const int N = 2e5 + 10, INF = 1e9 + 10;
int n, m, q, tn, bit;
vector<int> G[N], E[N];
int val[N], low[N], t[N], dfn, stk[N], stktop;
multiset<int> st[N];
void pre_dfs(int u, int f) {
  low[u] = t[u] = ++dfn;
  stk[++stktop] = u;
  for (auto v : G[u]) {
    if (v == f) continue;
    if (!t[v]) {
      pre_dfs(v, u);
      if (low[v] >= t[u]) {
        for (int t = ++n; t != v;) E[n].push_back(t = stk[stktop--]);
        E[u].push_back(n);
      } else
        cmin(low[u], low[v]);
    } else
      cmin(low[u], t[v]);
  }
}
int dep[N], top[N], fa[N], sz[N], son[N], L[N], R[N], id[N], mi[N];
void dfs1(int u, int f) {
  if (u <= tn) st[f].insert(val[u]);
  fa[u] = f, sz[u] = 1;
  for (auto v : E[u]) {
    dep[v] = dep[u] + 1;
    dfs1(v, u);
    sz[u] += sz[v];
    if (sz[v] > sz[son[u]]) son[u] = v;
  }
  mi[u] = st[u].size() ? *st[u].begin() : val[u];
}
void dfs2(int u, int t) {
  id[L[u] = ++dfn] = u, top[u] = t;
  if (son[u]) dfs2(son[u], t);
  for (auto v : E[u]) {
    if (v == son[u]) continue;
    dfs2(v, v);
  }
  R[u] = dfn;
}
int s[N << 2];
void Build() {
  bit = 1;
  while (bit <= n + 1) bit <<= 1;
  memset(s, 127, sizeof s);
  for (int i = 1, iend = n; i <= iend; ++i) s[i + bit] = mi[id[i]];
  for (int i = bit, iend = 1; i >= iend; --i)
    s[i] = min(s[i << 1], s[i << 1 | 1]);
}
void Upd(int p, int x) {
  s[p += bit] = x;
  while (p > 1) p >>= 1, s[p] = min(s[p << 1], s[p << 1 | 1]);
}
int Que(int l, int r) {
  if (l == r) return s[l + bit];
  int res = INF;
  for (l += bit - 1, r += bit + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {
    ((~l & 1) && res > s[l ^ 1] && (res = s[l ^ 1]));
    ((r & 1) && res > s[r ^ 1] && (res = s[r ^ 1]));
  }
  return res;
}
void Set(int u, int x) {
  Upd(L[u], x);
  if (!fa[u]) return (void)(val[u] = x);
  st[fa[u]].erase(st[fa[u]].find(val[u]));
  st[fa[u]].insert(val[u] = x);
  Upd(L[fa[u]], mi[fa[u]] = *st[fa[u]].begin());
}
int Quepath(int x, int y) {
  if (x == y) return val[x];
  int res = INF;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    cmin(res, Que(L[top[x]], L[x]));
    x = fa[top[x]];
  }
  if (L[x] > L[y]) swap(x, y);
  cmin(res, Que(L[x], L[y]));
  if (x > tn) cmin(res, val[fa[x]]);
  return res;
}
char opt[2];
int main() {
  tn = n = rd(), m = rd(), q = rd();
  for (int i = 1, iend = n; i <= iend; ++i) val[i] = rd();
  for (int i = 1, iend = m; i <= iend; ++i) {
    int u = rd(), v = rd();
    G[u].push_back(v), G[v].push_back(u);
  }
  pre_dfs(1, 0), dfn = 0;
  dfs1(1, 0), dfs2(1, 1);
  Build();
  for (int i = 1, iend = q; i <= iend; ++i) {
    scanf("%s", opt);
    if (opt[0] == 'C') {
      int x = rd(), w = rd();
      Set(x, w);
    } else
      printf("%d\n", Quepath(rd(), rd()));
  }
}