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>
template <typename T>
bool ckmax(T &x, T y) {
  return x < y ? x = y, true : false;
}
template <typename T>
bool ckmin(T &x, T y) {
  return x > y ? x = y, true : false;
}
using namespace std;
const long long inf = (1ll << 60);
const double Pi = acos(-1);
const long long mod = 1e9 + 7;
const double eps = 1e-6;
inline long long fpow(long long a, long long b = mod - 2, long long p = mod) {
  a %= p;
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % p;
    a = a * a % p;
    b >>= 1;
  }
  return res;
}
inline long long read() {
  char c = getchar();
  long long x = 0;
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
  return x;
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    write(-x);
    return;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writesp(long long x) { write(x), putchar(' '); }
inline void writeln(long long x) {
  write(x);
  putchar('\n');
}
long long totds;
long long n, m, q, w[200020];
struct dheap {
  priority_queue<long long, vector<long long>, greater<long long> > q, qd;
  inline void ins(long long x) { q.push(x); }
  inline void era(long long x) { qd.push(x); }
  inline long long top() {
    if (q.size() == qd.size()) return inf;
    while (qd.size() && q.top() == qd.top()) q.pop(), qd.pop();
    return q.top();
  }
} s[100010];
namespace yfs {
vector<long long> e[200020];
long long fa[200020], htop[200020], hson[200020], id[200020];
long long siz[200020], dep[200020], st[200020], tim;
long long mn[800080];
inline void add_edge(long long u, long long v) {
  e[u].push_back(v);
  e[v].push_back(u);
}
void dfs1(long long u) {
  siz[u] = 1;
  for (long long v : e[u])
    if (v ^ fa[u]) {
      fa[v] = u, dep[v] = dep[u] + 1;
      dfs1(v);
      siz[u] += siz[v];
      hson[u] = (siz[v] > siz[hson[u]]) ? v : hson[u];
    }
  if (fa[u] > n) {
    s[fa[u] - n].ins(w[u]);
  }
}
void dfs2(long long u, long long topf) {
  htop[u] = topf;
  st[u] = ++tim;
  id[tim] = u;
  if (hson[u]) dfs2(hson[u], topf);
  for (long long v : e[u])
    if (v ^ fa[u] && v ^ hson[u]) dfs2(v, v);
}
inline void push_up(long long x) { mn[x] = min(mn[x << 1], mn[x << 1 | 1]); }
void build(long long l, long long r, long long x) {
  if (l == r) {
    mn[x] = w[id[l]];
    return;
  }
  long long mid = (l + r) >> 1;
  build(l, mid, x << 1), build(mid + 1, r, x << 1 | 1);
  push_up(x);
}
void modify(long long p, long long l, long long r, long long x, long long k) {
  if (l == r) {
    mn[x] = k;
    return;
  }
  long long mid = (l + r) >> 1;
  if (p <= mid)
    modify(p, l, mid, x << 1, k);
  else
    modify(p, mid + 1, r, x << 1 | 1, k);
  push_up(x);
}
long long query(long long L, long long R, long long l, long long r,
                long long x) {
  if (L <= l && r <= R) return mn[x];
  long long mid = (l + r) >> 1, ret = inf;
  if (L <= mid) ckmin(ret, query(L, R, l, mid, x << 1));
  if (mid < R) ckmin(ret, query(L, R, mid + 1, r, x << 1 | 1));
  return ret;
}
long long query_path(long long u, long long v) {
  long long ret = inf;
  while (htop[u] ^ htop[v]) {
    if (dep[htop[u]] < dep[htop[v]]) swap(u, v);
    ckmin(ret, query(st[htop[u]], st[u], 1, totds, 1));
    u = fa[htop[u]];
  }
  if (dep[u] > dep[v]) swap(u, v);
  ckmin(ret, query(st[u], st[v], 1, totds, 1));
  if (u > n) ckmin(ret, w[fa[u]]);
  return ret;
}
void print() {
  puts("");
  puts("---------------------hooooooooooooooooo--------------------");
  printf("mn:");
  for (long long i = (1), iE = (20); i <= iE; i++) printf("%lld ", mn[i]);
  puts("");
  puts("---------------------qwwwwwwwwwwwwwwwww--------------------");
  puts("");
}
void mian() {
  yfs::dep[1] = 1;
  dfs1(1);
  dfs2(1, 1);
  for (long long i = (n + 1), iE = (totds); i <= iE; i++) w[i] = s[i - n].top();
  build(1, totds, 1);
}
}  // namespace yfs
namespace yg {
long long stk[100010], top;
long long low[100010], dfn[100010], tim, fa[100010];
vector<long long> e[100010];
inline void add_edge(long long u, long long v) {
  e[u].push_back(v), e[v].push_back(u);
}
void tarjan(long long u) {
  low[u] = dfn[u] = ++tim;
  stk[++top] = u;
  for (long long v : e[u])
    if (v ^ fa[u]) {
      fa[v] = u;
      if (!dfn[v]) {
        tarjan(v);
        ckmin(low[u], low[v]);
        if (low[v] >= dfn[u]) {
          w[++totds] = inf;
          yfs::add_edge(u, totds);
          do yfs::add_edge(stk[top], totds);
          while (stk[top--] ^ v);
        }
      } else
        ckmin(low[u], dfn[v]);
    }
}
}  // namespace yg
signed main() {
  totds = n = read(), m = read(), q = read();
  for (long long i = (1), iE = (n); i <= iE; i++) w[i] = read();
  long long u, v, l;
  for (long long i = (1), iE = (m); i <= iE; i++)
    u = read(), v = read(), yg::add_edge(u, v);
  yg::tarjan(1);
  yfs::mian();
  char opt[5];
  while (q--) {
    scanf("%s", opt + 1);
    u = read(), v = read();
    if (opt[1] == 'C') {
      l = yfs::fa[u];
      if (l) {
        s[l - n].era(w[u]), s[l - n].ins(v);
        yfs::modify(yfs::st[l], 1, totds, 1, w[l] = s[l - n].top());
      }
      yfs::modify(yfs::st[u], 1, totds, 1, w[u] = v);
    }
    if (opt[1] == 'A') writeln(yfs::query_path(u, v));
  }
}
