/// 求森林间链接一条新的边之后，两棵子树中每个点到树上最远距离的期望
/// 枚举一颗子树的所有点， 如果链接之后整棵树的直径变长 dis[l] + dis[r] + 1 > max(d[l], d[r])
/// 后半部分的期望会改变，以此前缀和二分
/**
 * @Samaritan
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

#define pb emplace_back
#define fi first
#define se second
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define PLI pair<LL, int>

LL quick_pow (LL a, LL b, LL mod) {
    LL ans = 1, base = a;
    while (b) {
        if (b & 1) (ans *= base) %= mod;
        b >>= 1;
        (base *= base) %= mod;
    }
    return ans;
}
void gcd(LL a, LL b, LL &d, LL &x, LL &y) {
    if (!b) {
        d = a; x = 1; y = 0;
    } else {
        gcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
LL get_inv(LL a, LL n) {
    LL d, x, y;
    gcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
inline int log2(const float &x) {
    return ((unsigned &) x >> 23 & 255) - 127;
}
template <typename type>
void show(type arr[], int len) {
    for (int i = 0; i <= len; ++i) {
        cout << arr[i] << " ";
    }
    cout << endl;
}
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
const int M = 1e6 + 5;
const int logN = 20;
const int INF = 1e7;

struct Edge {
    int v, nxt;
} edge[N << 1];
int head[N], edge_cnt;
inline void add_edge(int u, int v) {
    edge[edge_cnt] = {v, head[u]};
    head[u] = edge_cnt++;
}
int belong[N], belong_cnt;
/// 每一个点在自己子树里到最远点的距离
int vertice_dis[N];
/// 每一棵子树里的直径长度
int diameter[N];
/// 每一个子树里的点到最远点的距离，前缀和
vector<int> dis[N];
vector<int> pre[N];
void init(int n) {
    memset(head, -1, sizeof(head[0]) * (n + 3));
    edge_cnt = 0;
    belong_cnt = 0;
}
/// 搜索直径
int diameter_length, st, ed;
void dfs_d(int now, int par, int belong_id, int dep) {
    belong[now] = belong_id;
    if (dep > diameter_length) {
        diameter_length = dep;
        st = now;
    }
    for (int i = head[now]; ~i; i = edge[i].nxt) {
        int to = edge[i].v;
        if (to != par) {
            dfs_d(to, now, belong_id, dep + 1);
        }
    }
}
void dfs(int now, int par, int dep) {
    vertice_dis[now] = max(vertice_dis[now], dep);
    for (int i = head[now]; ~i; i = edge[i].nxt) {
        int to = edge[i].v;
        if (to != par) {
            dfs(to, now, dep + 1);
        }
    }
}
map<PII, double> cache;

int main() {
    int n, m, q;
    scanf("%d %d %d", &n, &m, &q);
    init(n);
    int l, r;
    for (int i = 0; i < m; ++i) {
        scanf("%d %d", &l, &r);
        add_edge(l, r); add_edge(r, l);
    }
    for (int i = 1; i <= n; ++i) if (!belong[i]) {
        st = i;
        diameter_length = 0;
        dfs_d(i, -1, ++belong_cnt, 0);
        ed = st;
        st = i;
        diameter_length = 0;
        dfs_d(ed, -1, belong_cnt, 0);
        diameter[belong_cnt] = diameter_length;
        dfs(st, -1, 0);
        dfs(ed, -1, 0);
    }
    for (int i = 1; i <= n; ++i) {
        dis[ belong[i] ].pb(vertice_dis[i]);
    }
    for (int i = 1; i <= belong_cnt; ++i) {
        sort (dis[i].begin(), dis[i].end());
        pre[i].resize(dis[i].size());
        pre[i][0] = dis[i][0];
        for (int j = 1; j < dis[i].size(); ++j) {
            pre[i][j] = pre[i][j - 1] + dis[i][j];
        }
    }
//    for (int i = 1; i <= belong_cnt; ++i) {
//        cout << "now : ";
//        for (int j : dis[i]) cout << j << " "; cout << endl;
//    }
    while (q--) {
        scanf("%d %d", &l, &r);
        l = belong[l]; r = belong[r];
        if (dis[l].size() > dis[r].size() || (dis[l].size() == dis[r].size() && l > r)) swap(l, r);
        if (l == r) puts("-1");
        else if (cache.count({l, r})) printf("%.10f\n", cache[{l, r}]);
        else {
            double ans = 0.0;
            int max_diameter = max(diameter[l], diameter[r]);

            for (int i : dis[l]) {
                int pos = upper_bound(dis[r].begin(), dis[r].end(), max_diameter - i - 1) - dis[r].begin();
                if (pos == dis[r].size()) ans += max_diameter * dis[r].size() * 1.0;
                else
                    ans += max_diameter * pos * 1.0 + (i + 1) * (dis[r].size() - pos) + pre[r].back() - (pos == 0 ? 0 : pre[r][pos - 1]);
            }
            ans /= (dis[l].size() * dis[r].size() * 1.0);
            cache[{l, r}] = ans;
            printf("%.10f\n", ans);
        }
    }
    return 0;
}


/// 求森林间链接一条新的边之后，两棵子树中每个点到树上最远距离的期望
/// 枚举一颗子树的所有点， 如果链接之后整棵树的直径变长 dis[l] + dis[r] + 1 > max(d[l], d[r])
/// 后半部分的期望会改变，以此前缀和二分
/**
 * @Samaritan
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

#define pb emplace_back
#define fi first
#define se second
#define PII pair<int, int>
#define PLL pair<LL, LL>
#define PLI pair<LL, int>

LL quick_pow (LL a, LL b, LL mod) {
    LL ans = 1, base = a;
    while (b) {
        if (b & 1) (ans *= base) %= mod;
        b >>= 1;
        (base *= base) %= mod;
    }
    return ans;
}
void gcd(LL a, LL b, LL &d, LL &x, LL &y) {
    if (!b) {
        d = a; x = 1; y = 0;
    } else {
        gcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
LL get_inv(LL a, LL n) {
    LL d, x, y;
    gcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
inline int log2(const float &x) {
    return ((unsigned &) x >> 23 & 255) - 127;
}
template <typename type>
void show(type arr[], int len) {
    for (int i = 0; i <= len; ++i) {
        cout << arr[i] << " ";
    }
    cout << endl;
}
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
const int M = 1e6 + 5;
const int logN = 20;
const int INF = 1e7;

struct Edge {
    int v, nxt;
} edge[N << 1];
int head[N], edge_cnt;
inline void add_edge(int u, int v) {
    edge[edge_cnt] = {v, head[u]};
    head[u] = edge_cnt++;
}
int belong[N], belong_cnt;
/// 每一个点在自己子树里到最远点的距离
int vertice_dis[N];
/// 每一棵子树里的直径长度
int diameter[N];
/// 每一个子树里的点到最远点的距离，前缀和
vector<int> dis[N];
vector<LL> pre[N];
void init(int n) {
    memset(head, -1, sizeof(head[0]) * (n + 3));
    edge_cnt = 0;
    belong_cnt = 0;
}
/// 搜索直径
int diameter_length, st, ed;
void dfs_d(int now, int par, int belong_id, int dep) {
    belong[now] = belong_id;
    if (dep > diameter_length) {
        diameter_length = dep;
        st = now;
    }
    for (int i = head[now]; ~i; i = edge[i].nxt) {
        int to = edge[i].v;
        if (to != par) {
            dfs_d(to, now, belong_id, dep + 1);
        }
    }
}
void dfs(int now, int par, int dep) {
    vertice_dis[now] = max(vertice_dis[now], dep);
    for (int i = head[now]; ~i; i = edge[i].nxt) {
        int to = edge[i].v;
        if (to != par) {
            dfs(to, now, dep + 1);
        }
    }
}
map<PII, double> cache;

int main() {
    int n, m, q;
    scanf("%d %d %d", &n, &m, &q);
    init(n);
    int l, r;
    for (int i = 0; i < m; ++i) {
        scanf("%d %d", &l, &r);
        add_edge(l, r); add_edge(r, l);
    }
    for (int i = 1; i <= n; ++i) if (!belong[i]) {
        st = i;
        diameter_length = 0;
        dfs_d(i, -1, ++belong_cnt, 0);
        ed = st;
        st = i;
        diameter_length = 0;
        dfs_d(ed, -1, belong_cnt, 0);
        diameter[belong_cnt] = diameter_length;
        dfs(st, -1, 0);
        dfs(ed, -1, 0);
    }
    for (int i = 1; i <= n; ++i) {
        dis[ belong[i] ].pb(vertice_dis[i]);
    }
    for (int i = 1; i <= belong_cnt; ++i) {
        sort (dis[i].begin(), dis[i].end());
        pre[i].resize(dis[i].size());
        pre[i][0] = dis[i][0];
        for (int j = 1; j < dis[i].size(); ++j) {
            pre[i][j] = pre[i][j - 1] + dis[i][j];
        }
    }
//    for (int i = 1; i <= belong_cnt; ++i) {
//        cout << "now : ";
//        for (int j : dis[i]) cout << j << " "; cout << endl;
//    }
    while (q--) {
        scanf("%d %d", &l, &r);
        l = belong[l]; r = belong[r];
        if (dis[l].size() > dis[r].size() || (dis[l].size() == dis[r].size() && l > r)) swap(l, r);
        if (l == r) puts("-1");
        else if (cache.count({l, r})) printf("%.10f\n", cache[{l, r}]);
        else {
            double ans = 0.0;
            int max_diameter = max(diameter[l], diameter[r]);

            for (int i : dis[l]) {
                int pos = upper_bound(dis[r].begin(), dis[r].end(), max_diameter - i - 1) - dis[r].begin();
                if (pos == dis[r].size()) ans += max_diameter * 1.0 * dis[r].size();
                else
                    ans += max_diameter * 1.0 * pos + (i + 1) * 1.0 * (dis[r].size() - pos) + pre[r].back() - (pos == 0 ? 0 : pre[r][pos - 1]);
            }
            ans /= (dis[l].size() * dis[r].size() * 1.0);
            cache[{l, r}] = ans;
            printf("%.10f\n", ans);
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define ALL(c) (c).begin(), (c).end()
using namespace std;
using ll = long long;
using ld = long double;

const int N = 1e5+5;
const int S = 333;

vector<int> g[N];

int p[N], sz[N];

int get(int i){
	return i==p[i] ? i : (p[i] = get(p[i]));
}

int un(int i, int j){
	i=get(i);
	j=get(j);
	if(i==j) return 0;
	if(sz[i]<sz[j]) swap(i,j);
	p[j]=i;
	sz[i]+=sz[j];
	return 1;
}

bool u[N];

int dd[N], d[N];

vector<int> comp[N], cd[N];
vector<ll> cs[N];
int cn, loc[N];
int diam[N];

void go1(int v, int par = -1){
	comp[cn].push_back(v);
	loc[v] = cn;
	dd[v] = 0;
	for(int i : g[v]) if(i!=par){
		go1(i, v);
		dd[v] = max(dd[v], dd[i] + 1);
	}
}

void go2(int v, int up, int par = -1){
	d[v] = max(dd[v], up);
	u[v] = 1;

	set<pair<int,int>> q;
	for(int i : g[v]) if(i!=par) q.insert({dd[i], i});

	for(int i : g[v]) if(i!=par){
		q.erase({dd[i], i});
		int val = q.size() ? (q.rbegin()->first + 1) : 0;
		val = max(val, up) + 1;
		go2(i, val, v);
	}
}

int main(){
	/*if(01){
		srand(time(0));
		ofstream cout("input.txt");
		int n = 1e5;
		int sq = sqrt(n);

		vector<pair<int,int>> e;
		for(int i=1;i<=n;++i) if((i-1)%sq){
			e.push_back({i,i-1});
		}

		cout<<n<<' '<<e.size()<<' '<<100000<<endl;
		for(auto pp : e) cout<<pp.first<<' '<<pp.second<<endl;
		for(int i=0;i<1e5;++i) cout<<rand()%n+1<<' '<<rand()%n+1<<endl;

		cout.close();
	}*/
	//freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout);
	ios::sync_with_stdio(0);cin.tie(0);cout.precision(12);cout<<fixed;

	int n, m, q;

	cin>>n>>m>>q;

	for(int i=1;i<=n;++i) p[i]=i, sz[i]=i;

	for(int k=0;k<m;++k){
		int i,j;
		cin>>i>>j;
		g[i].push_back(j);
		g[j].push_back(i);
		un(i,j);
	}

	for(int i=1;i<=n;++i) if(!u[i]){
		++cn;
		go1(i);
		go2(i, 0);
	}

	//for(int i=1;i<=n;++i) cout<<i<<": "<<d[i]<<endl;

	for(int i=1;i<=cn;++i){
		for(int v : comp[i]) cd[i].push_back(d[v]);
		sort(ALL(cd[i]));
		diam[i] = cd[i].back();
		//for(int x : cd[i]) cout<<x<<' '; cout<<endl;

		auto &ss = cs[i];
		ss.resize(cd[i].size() + 1);
		for(int k=cd[i].size()-1; k>=0; --k) ss[k] = ss[k+1] + cd[i][k];
	}

	#define endl '\n'

	map<pair<int,int>, ld> mem;

	while(q--){
		int i, j;
		cin>>i>>j;
		i = get(i);
		j = get(j);
		if(i==j){
			cout<<-1<<endl;
			continue;
		}

		if(comp[loc[i]].size()>comp[loc[j]].size()) swap(i,j);

		int li = loc[i], lj = loc[j];
		if(mem.count({li,lj})){
			cout<<mem[{li,lj}]<<endl;
			continue;
		}

		int D = max(diam[i], diam[j]);

		/*ld p1 = 0, q1 = 0;
		for(int x : comp[li])
		for(int y : comp[lj]){
			++q1;
			p1+=max(D, d[x]+1+d[y]);
		}
		ld ans1 = p1/q1;*/
		//cout<<ans1<<endl;

		ld sum = 0;

		for(int dx : cd[li]){
			int it = upper_bound(ALL(cd[lj]), D-dx-1) - cd[lj].begin();
			sum+=1LL*it*D;
			sum+=cs[lj][it];
			sum+=(dx+1) * 1LL * (comp[lj].size()-it);
		}

		ld cnt = 1LL * comp[li].size() * comp[lj].size();

		ld ans = sum / cnt;

		cout<<ans<<endl;
		//assert(abs(ans-ans1)<1e-9);

		mem[{li,lj}] = ans;
	}

	return 0;
}


#include<bits/stdc++.h>
#define ALL(c) (c).begin(), (c).end()
using namespace std;
using ll = long long;
using ld = long double;

const int N = 1e5+5;
const int S = 333;

vector<int> g[N];

int p[N], sz[N];

int get(int i){
	return i==p[i] ? i : (p[i] = get(p[i]));
}

int un(int i, int j){
	i=get(i);
	j=get(j);
	if(i==j) return 0;
	if(sz[i]<sz[j]) swap(i,j);
	p[j]=i;
	sz[i]+=sz[j];
	return 1;
}

bool u[N];

int dd[N], d[N];

vector<int> comp[N], cd[N], cs[N];
int cn, loc[N];
int diam[N];

void go1(int v, int par = -1){
	comp[cn].push_back(v);
	loc[v] = cn;
	dd[v] = 0;
	for(int i : g[v]) if(i!=par){
		go1(i, v);
		dd[v] = max(dd[v], dd[i] + 1);
	}
}

void go2(int v, int up, int par = -1){
	d[v] = max(dd[v], up);
	u[v] = 1;

	set<pair<int,int>> q;
	for(int i : g[v]) if(i!=par) q.insert({dd[i], i});

	for(int i : g[v]) if(i!=par){
		q.erase({dd[i], i});
		int val = q.size() ? (q.rbegin()->first + 1) : 0;
		val = max(val, up) + 1;
		go2(i, val, v);
	}
}

int main(){
	/*if(01){
		srand(time(0));
		ofstream cout("input.txt");
		int n = 1e5;
		int sq = sqrt(n);

		vector<pair<int,int>> e;
		for(int i=1;i<=n;++i) if((i-1)%sq){
			e.push_back({i,i-1});
		}

		cout<<n<<' '<<e.size()<<' '<<100000<<endl;
		for(auto pp : e) cout<<pp.first<<' '<<pp.second<<endl;
		for(int i=0;i<1e5;++i) cout<<rand()%n+1<<' '<<rand()%n+1<<endl;

		cout.close();
	}*/
	//freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout);
	ios::sync_with_stdio(0);cin.tie(0);cout.precision(12);cout<<fixed;

	int n, m, q;

	cin>>n>>m>>q;

	for(int i=1;i<=n;++i) p[i]=i, sz[i]=i;

	for(int k=0;k<m;++k){
		int i,j;
		cin>>i>>j;
		g[i].push_back(j);
		g[j].push_back(i);
		un(i,j);
	}

	for(int i=1;i<=n;++i) if(!u[i]){
		++cn;
		go1(i);
		go2(i, 0);
	}

	//for(int i=1;i<=n;++i) cout<<i<<": "<<d[i]<<endl;

	for(int i=1;i<=cn;++i){
		for(int v : comp[i]) cd[i].push_back(d[v]);
		sort(ALL(cd[i]));
		diam[i] = cd[i].back();
		//for(int x : cd[i]) cout<<x<<' '; cout<<endl;

		auto &ss = cs[i];
		ss.resize(cd[i].size() + 1);
		for(int k=cd[i].size()-1; k>=0; --k) ss[k] = ss[k+1] + cd[i][k];
	}

	#define endl '\n'

	map<pair<int,int>, ld> mem;

	while(q--){
		int i, j;
		cin>>i>>j;
		i = get(i);
		j = get(j);
		if(i==j){
			cout<<-1<<endl;
			continue;
		}

		if(comp[loc[i]].size()>comp[loc[j]].size()) swap(i,j);

		int li = loc[i], lj = loc[j];
		if(mem.count({li,lj})){
			cout<<mem[{li,lj}]<<endl;
			continue;
		}

		int D = max(diam[i], diam[j]);

		/*ld p1 = 0, q1 = 0;
		for(int x : comp[li])
		for(int y : comp[lj]){
			++q1;
			p1+=max(D, d[x]+1+d[y]);
		}
		ld ans1 = p1/q1;
		cout<<ans1<<endl;*/

		ld sum = 0;

		for(int x : comp[li]){
			int it = upper_bound(ALL(comp[lj]), D-d[x]-1) - comp[lj].begin();
			sum+=1LL*it*D;
			sum+=cs[lj][it];
			sum+=(d[x]+1) * 1LL * (comp[lj].size()-it);
		}

		ld cnt = 1LL * comp[li].size() * comp[lj].size();

		ld ans = sum / cnt;

		cout<<ans<<endl;

		mem[{li,lj}] = ans;

	}

	return 0;
}


#include<bits/stdc++.h>
#define ALL(c) (c).begin(), (c).end()
using namespace std;
using ll = long long;
using ld = long double;

struct dsu{
	vector<int> p, sz;
	dsu(){}
	dsu(int n){
		p.resize(n);
		sz.resize(n);
		for(int i=0;i<n;++i) p[i]=i, sz[i]=1;
	}
	int get(int i){
		return i==p[i] ? i : p[i]=get(p[i]);
	}
	bool unite(int i, int j){
		i = get(i);
		j = get(j);
		if(i==j) return false;
		if(sz[i]<sz[j]) swap(i,j);
		p[j] = i;
		sz[i]+=sz[j];
	}
};

const int N = 1e5+5;

vector<int> g[N];
bool u[N];

int dd[N], d[N];

vector<int> comp[N], cd[N];
vector<ll> cs[N];
int cn, loc[N];
int diam[N];

void go1(int v, int par = -1){
	comp[cn].push_back(v);
	loc[v] = cn;
	dd[v] = 0;
	for(int i : g[v]) if(i!=par){
		go1(i, v);
		dd[v] = max(dd[v], dd[i] + 1);
	}
}

void go2(int v, int up, int par = -1){
	d[v] = max(dd[v], up);
	u[v] = 1;

	set<pair<int,int>> q;
	for(int i : g[v]) if(i!=par) q.insert({dd[i], i});

	for(int i : g[v]) if(i!=par){
		q.erase({dd[i], i});
		int val = q.size() ? (q.rbegin()->first + 1) : 0;
		val = max(val, up) + 1;
		go2(i, val, v);
		q.insert({dd[i], i});
	}
}

int main(){
	/*if(01){
		srand(time(0));
		ofstream cout("input.txt");
		int n = 1e5;
		int sq = sqrt(n);

		vector<pair<int,int>> e;
		for(int i=1;i<=n;++i) if((i-1)%sq){
			e.push_back({i,i-1});
		}

		cout<<n<<' '<<e.size()<<' '<<100000<<endl;
		for(auto pp : e) cout<<pp.first<<' '<<pp.second<<endl;
		for(int i=0;i<1e5;++i) cout<<rand()%n+1<<' '<<rand()%n+1<<endl;

		cout.close();
	}*/
	//freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout);
	ios::sync_with_stdio(0);cin.tie(0);cout.precision(10);cout<<fixed;

	int n, m, q;

	cin>>n>>m>>q;

	dsu p(n+1);

	for(int k=0;k<m;++k){
		int i,j;
		cin>>i>>j;
		g[i].push_back(j);
		g[j].push_back(i);
		p.unite(i,j);
	}

	for(int i=1;i<=n;++i) if(!u[i]){
		++cn;
		go1(i);
		go2(i, 0);
	}

	//for(int i=1;i<=n;++i) cout<<i<<": "<<d[i]<<endl;

	for(int i=1;i<=cn;++i){
		for(int v : comp[i]) cd[i].push_back(d[v]);
		sort(ALL(cd[i]));
		diam[i] = cd[i].back();
		//for(int x : cd[i]) cout<<x<<' '; cout<<endl;

		auto &ss = cs[i];
		ss.resize(cd[i].size() + 1);
		for(int k=cd[i].size()-1; k>=0; --k) ss[k] = ss[k+1] + cd[i][k];
	}

	#define endl '\n'

	map<pair<int,int>, ld> mem;

	while(q--){
		int i, j;
		cin>>i>>j;
		i = p.get(i);
		j = p.get(j);
		if(i==j){
			cout<<-1<<endl;
			continue;
		}

		if(comp[loc[i]].size()>comp[loc[j]].size()) swap(i,j);

		int li = loc[i], lj = loc[j];
		if(mem.count({li,lj})){
			cout<<mem[{li,lj}]<<endl;
			continue;
		}

		int D = max(diam[li], diam[lj]);

		/*ld p1 = 0, q1 = 0;
		for(int x : comp[li])
		for(int y : comp[lj]){
			++q1;
			p1+=max(D, d[x]+1+d[y]);
		}
		ld ans1 = p1/q1;*/
		//cout<<ans1<<endl;

		ld sum = 0;

		for(int dx : cd[li]){
			int it = upper_bound(ALL(cd[lj]), D-dx-1) - cd[lj].begin();
			sum+=1LL*it*D;
			sum+=cs[lj][it];
			sum+=(dx+1) * 1LL * (cd[lj].size()-it);
		}

		ld cnt = 1LL * cd[li].size() * cd[lj].size();

		ld ans = sum / cnt;

		cout<<ans<<endl;
		//assert(abs(ans-ans1)<1e-9);

		mem[{li,lj}] = ans;
	}

	return 0;
}


#include<bits/stdc++.h>
#define ALL(c) (c).begin(), (c).end()
using namespace std;
using ll = long long;
using ld = long double;

const int N = 1e5+5;
const int S = 333;

vector<int> g[N];

int p[N], sz[N];

int get(int i){
	return i==p[i] ? i : (p[i] = get(p[i]));
}

int un(int i, int j){
	i=get(i);
	j=get(j);
	if(i==j) return 0;
	if(sz[i]<sz[j]) swap(i,j);
	p[j]=i;
	sz[i]+=sz[j];
	return 1;
}

bool u[N];

int dd[N], d[N];

vector<int> comp[N], cd[N];
vector<ll> cs[N];
int cn, loc[N];
int diam[N];

void go1(int v, int par = -1){
	comp[cn].push_back(v);
	loc[v] = cn;
	dd[v] = 0;
	for(int i : g[v]) if(i!=par){
		go1(i, v);
		dd[v] = max(dd[v], dd[i] + 1);
	}
}

void go2(int v, int up, int par = -1){
	d[v] = max(dd[v], up);
	u[v] = 1;

	set<pair<int,int>> q;
	for(int i : g[v]) if(i!=par) q.insert({dd[i], i});

	for(int i : g[v]) if(i!=par){
		q.erase({dd[i], i});
		int val = q.size() ? (q.rbegin()->first + 1) : 0;
		val = max(val, up) + 1;
		go2(i, val, v);
	}
}

int main(){
	/*if(01){
		srand(time(0));
		ofstream cout("input.txt");
		int n = 1e5;
		int sq = sqrt(n);

		vector<pair<int,int>> e;
		for(int i=1;i<=n;++i) if((i-1)%sq){
			e.push_back({i,i-1});
		}

		cout<<n<<' '<<e.size()<<' '<<100000<<endl;
		for(auto pp : e) cout<<pp.first<<' '<<pp.second<<endl;
		for(int i=0;i<1e5;++i) cout<<rand()%n+1<<' '<<rand()%n+1<<endl;

		cout.close();
	}*/
	//freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout);
	ios::sync_with_stdio(0);cin.tie(0);cout.precision(10);cout<<fixed;

	int n, m, q;

	cin>>n>>m>>q;

	for(int i=1;i<=n;++i) p[i]=i, sz[i]=i;

	for(int k=0;k<m;++k){
		int i,j;
		cin>>i>>j;
		g[i].push_back(j);
		g[j].push_back(i);
		un(i,j);
	}

	for(int i=1;i<=n;++i) if(!u[i]){
		++cn;
		go1(i);
		go2(i, 0);
	}

	//for(int i=1;i<=n;++i) cout<<i<<": "<<d[i]<<endl;

	for(int i=1;i<=cn;++i){
		for(int v : comp[i]) cd[i].push_back(d[v]);
		sort(ALL(cd[i]));
		diam[i] = cd[i].back();
		//for(int x : cd[i]) cout<<x<<' '; cout<<endl;

		auto &ss = cs[i];
		ss.resize(cd[i].size() + 1);
		for(int k=cd[i].size()-1; k>=0; --k) ss[k] = ss[k+1] + cd[i][k];
	}

	#define endl '\n'

	map<pair<int,int>, ld> mem;

	while(q--){
		int i, j;
		cin>>i>>j;
		i = get(i);
		j = get(j);
		if(i==j){
			cout<<-1<<endl;
			continue;
		}

		if(comp[loc[i]].size()>comp[loc[j]].size()) swap(i,j);

		int li = loc[i], lj = loc[j];
		if(mem.count({li,lj})){
			cout<<mem[{li,lj}]<<endl;
			continue;
		}

		int D = max(diam[li], diam[lj]);

		/*ld p1 = 0, q1 = 0;
		for(int x : comp[li])
		for(int y : comp[lj]){
			++q1;
			p1+=max(D, d[x]+1+d[y]);
		}
		ld ans1 = p1/q1;*/
		//cout<<ans1<<endl;

		ld sum = 0;

		for(int dx : cd[li]){
			int it = upper_bound(ALL(cd[lj]), D-dx-1) - cd[lj].begin();
			sum+=1LL*it*D;
			sum+=cs[lj][it];
			sum+=(dx+1) * 1LL * (cd[lj].size()-it);
		}

		ld cnt = 1LL * cd[li].size() * cd[lj].size();

		ld ans = sum / cnt;

		cout<<ans<<endl;
		//assert(abs(ans-ans1)<1e-9);

		mem[{li,lj}] = ans;
	}

	return 0;
}


#include <stdio.h>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <utility>

using namespace std;

#define pb push_back
#define ft first
#define sd second
#define mpr make_pair
#define all(x) begin((x)), end((x))
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define max3(a, b, c) max((a), max((b), (c)))
#define max4(a, b, c, d) max(max((a), (b)), max((c), (d)))
#define min3(a, b, c) min((a), min((b), (c)))
#define min4(a, b, c, d) min(min((a), (b)), min((c), (d)))
#define isz(x) (int)(x).size()

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int, int> pii;
typedef vector<int> vi;

/* <------------------------------------------------------------------------------------> */

const int MX = 1e5 + 7;

vector<int> g[MX], d[MX], suf_sum[MX];
int id[MX], diam[MX], mx[MX], mx1[MX], mxu[MX];
char us[MX];

void dfs(int v, int p, int cnt)
{
    us[v] = true;
    id[v] = cnt;
    for (int & u : g[v]) if (u != p)
    {
        dfs(u, v, cnt);
        if (mx[v] < mx[u] + 1)
        {
            mx1[v] = mx[v];
            mx[v] = mx[u] + 1;
            mxu[v] = u;
        }
        else if (mx1[v] < mx[u] + 1)
            mx1[v] = mx[u] + 1;
    }
}

void dfs1(int v, int p, int up, int cnt)
{
    d[cnt].pb(max(up, mx[v]));
    //printf("%d: %d\n", v + 1, d[cnt].back());
    diam[cnt] = max(diam[cnt], d[cnt].back());
    for (int & u : g[v]) if (u != p)
        dfs1(u, v, max(up, (u != mxu[v] ? mx[v] : mx1[v])) + 1, cnt);
}

void init(int v, int cnt)
{
    dfs(v, -1, cnt);
    dfs1(v, -1, 0, cnt);
    sort(all(d[cnt]));
    int n = isz(d[cnt]);
    suf_sum[cnt].resize(n);
    for (int i = n - 1; i >= 0; --i)
        suf_sum[cnt][i] = d[cnt][i] + (i == n - 1 ? 0 : suf_sum[cnt][i + 1]);
}

int binsearch(vector<int> & a, int d1, int dia)
{
    int l = 0, r = isz(a) - 1;
    while (l < r)
    {
        int m = (l + r + 1) >> 1;
        if (d1 + a[m] + 1 <= dia) l = m;
        else r = m - 1;
    }
    if (d1 + a[l] + 1 <= dia) return l;
    else return -1;
}

void solve()
{
    int n, m, q;
    scanf("%d%d%d", &n, &m, &q);
    while (m--)
    {
        int v, u;
        scanf("%d%d", &v, &u);
        g[v - 1].pb(u - 1);
        g[u - 1].pb(v - 1);
    }
    int cnt = 0;
    forn (i, n) if (!us[i]) init(i, cnt++);
    while (q--)
    {
        int v, u;
        scanf("%d%d", &v, &u);
        v = id[v - 1]; u = id[u - 1];
        if (v == u)
        {
            printf("-1\n");
            continue;
        }
        if (isz(d[v]) > isz(d[u])) swap(v, u);
        int n = isz(d[v]), m = isz(d[u]), dia = max(diam[v], diam[u]);
        ll ans = 0;
        forn (i, n)
        {
            int j = binsearch(d[u], d[v][i], dia);
            ans += 1LL * (j + 1) * dia + 1LL * (j == m - 1 ? 0 : suf_sum[u][j + 1]) + 1LL * (m - j - 1) * (d[v][i] + 1);
        }
        printf("%.10f\n", 1.0 * ans / (1.0 * n * m));
    }
}

/* <------------------------------------------------------------------------------------> */

// #define LOCAL
// #define FILE_NAME

int main()
{
    #if defined LOCAL
        freopen("input.txt", "r", stdin);
    #elif defined FILE_NAME
        freopen(FILE_NAME".in", "r", stdin);
        freopen(FILE_NAME".out", "w", stdout);
    #endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    solve();

    return 0;
}


#include <stdio.h>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <utility>

using namespace std;

#define pb push_back
#define ft first
#define sd second
#define mpr make_pair
#define all(x) begin((x)), end((x))
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define max3(a, b, c) max((a), max((b), (c)))
#define max4(a, b, c, d) max(max((a), (b)), max((c), (d)))
#define min3(a, b, c) min((a), min((b), (c)))
#define min4(a, b, c, d) min(min((a), (b)), min((c), (d)))
#define isz(x) (int)(x).size()

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int, int> pii;
typedef vector<int> vi;

/* <------------------------------------------------------------------------------------> */

const int MX = 1e5 + 7;

vector<int> g[MX], d[MX], suf_sum[MX];
int id[MX], diam[MX], mx[MX], mx1[MX], mxu[MX];
char us[MX];

map<pii, double> memo;

void dfs(int v, int p, int cnt)
{
    us[v] = true;
    id[v] = cnt;
    for (int & u : g[v]) if (u != p)
    {
        dfs(u, v, cnt);
        if (mx[v] < mx[u] + 1)
        {
            mx1[v] = mx[v];
            mx[v] = mx[u] + 1;
            mxu[v] = u;
        }
        else if (mx1[v] < mx[u] + 1)
            mx1[v] = mx[u] + 1;
    }
}

void dfs1(int v, int p, int up, int cnt)
{
    d[cnt].pb(max(up, mx[v]));
    //printf("%d: %d\n", v + 1, d[cnt].back());
    diam[cnt] = max(diam[cnt], d[cnt].back());
    for (int & u : g[v]) if (u != p)
        dfs1(u, v, max(up, (u != mxu[v] ? mx[v] : mx1[v])) + 1, cnt);
}

void init(int v, int cnt)
{
    dfs(v, -1, cnt);
    dfs1(v, -1, 0, cnt);
    sort(all(d[cnt]));
    int n = isz(d[cnt]);
    suf_sum[cnt].resize(n);
    for (int i = n - 1; i >= 0; --i)
        suf_sum[cnt][i] = d[cnt][i] + (i == n - 1 ? 0 : suf_sum[cnt][i + 1]);
}

int binsearch(vector<int> & a, int d1, int dia)
{
    int l = 0, r = isz(a) - 1;
    while (l < r)
    {
        int m = (l + r + 1) >> 1;
        if (d1 + a[m] + 1 <= dia) l = m;
        else r = m - 1;
    }
    if (d1 + a[l] + 1 <= dia) return l;
    else return -1;
}

void solve()
{
    int n, m, q;
    scanf("%d%d%d", &n, &m, &q);
    while (m--)
    {
        int v, u;
        scanf("%d%d", &v, &u);
        g[v - 1].pb(u - 1);
        g[u - 1].pb(v - 1);
    }
    int cnt = 0;
    forn (i, n) if (!us[i]) init(i, cnt++);
    while (q--)
    {
        int v, u;
        scanf("%d%d", &v, &u);
        v = id[v - 1]; u = id[u - 1];
        if (v == u)
        {
            printf("-1\n");
            continue;
        }
        if (isz(d[v]) > isz(d[u])) swap(v, u);
        if (memo.count({v, u}))
        {
            printf("%.10f\n", memo[{v, u}]);
            continue;
        }
        int n = isz(d[v]), m = isz(d[u]), dia = max(diam[v], diam[u]);
        ll ans = 0;
        forn (i, n)
        {
            int j = binsearch(d[u], d[v][i], dia);
            ans += 1LL * (j + 1) * dia + 1LL * (j == m - 1 ? 0 : suf_sum[u][j + 1]) + 1LL * (m - j - 1) * (d[v][i] + 1);
        }
        memo[{v, u}] = 1.0 * ans / (1.0 * n * m);
        printf("%.10f\n", memo[{v, u}]);
    }
}

/* <------------------------------------------------------------------------------------> */

// #define LOCAL
// #define FILE_NAME

int main()
{
    #if defined LOCAL
        freopen("input.txt", "r", stdin);
    #elif defined FILE_NAME
        freopen(FILE_NAME".in", "r", stdin);
        freopen(FILE_NAME".out", "w", stdout);
    #endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    solve();

    return 0;
}


#include <stdio.h>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <utility>

using namespace std;

#define pb push_back
#define ft first
#define sd second
#define mpr make_pair
#define all(x) begin((x)), end((x))
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define max3(a, b, c) max((a), max((b), (c)))
#define max4(a, b, c, d) max(max((a), (b)), max((c), (d)))
#define min3(a, b, c) min((a), min((b), (c)))
#define min4(a, b, c, d) min(min((a), (b)), min((c), (d)))
#define isz(x) (int)(x).size()

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int, int> pii;
typedef vector<int> vi;

/* <------------------------------------------------------------------------------------> */

const int MX = 1e5 + 7;

vector<int> g[MX], d[MX], suf_sum[MX];
int id[MX], diam[MX], mx[MX], mx1[MX], mxu[MX];
char us[MX];

void dfs(int v, int p, int cnt)
{
    us[v] = true;
    id[v] = cnt;
    for (int & u : g[v]) if (u != p)
    {
        dfs(u, v, cnt);
        if (mx[v] < mx[u] + 1)
        {
            mx1[v] = mx[v];
            mx[v] = mx[u] + 1;
            mxu[v] = u;
        }
    }
}

void dfs1(int v, int p, int up, int cnt)
{
    d[cnt].pb(max(up, mx[v]));
    diam[cnt] = max(diam[cnt], d[cnt].back());
    for (int & u : g[v]) if (u != p)
        dfs1(u, v, max(up, (u != mxu[v] ? mx[v] : mx1[v])) + 1, cnt);
}

void init(int v, int cnt)
{
    dfs(v, -1, cnt);
    dfs1(v, -1, 0, cnt);
    sort(all(d[cnt]));
    int n = isz(d[cnt]);
    suf_sum[cnt].resize(n);
    for (int i = n - 1; i >= 0; --i)
        suf_sum[cnt][i] = d[cnt][i] + (i == n - 1 ? 0 : suf_sum[cnt][i + 1]);
}

int binsearch(vector<int> & a, int d1, int dia)
{
    int l = 0, r = isz(a) - 1;
    while (l < r)
    {
        int m = (l + r + 1) >> 1;
        if (d1 + a[m] + 1 <= dia) l = m;
        else r = m - 1;
    }
    if (d1 + a[l] + 1 <= dia) return l;
    else return -1;
}

void solve()
{
    int n, m, q;
    scanf("%d%d%d", &n, &m, &q);
    while (m--)
    {
        int v, u;
        scanf("%d%d", &v, &u);
        g[v - 1].pb(u - 1);
        g[u - 1].pb(v - 1);
    }
    int cnt = 0;
    forn (i, n) if (!us[i]) init(i, cnt++);
    while (q--)
    {
        int v, u;
        scanf("%d%d", &v, &u);
        v = id[v - 1]; u = id[u - 1];
        if (v == u)
        {
            printf("-1\n");
            continue;
        }
        if (isz(d[v]) > isz(d[u])) swap(v, u);
        int n = isz(d[v]), m = isz(d[u]), dia = max(diam[v], diam[u]);
        ll ans = 0;
        forn (i, n)
        {
            int j = binsearch(d[u], d[v][i], dia);
            ans += 1LL * (j + 1) * dia + 1LL * (j == m - 1 ? 0 : suf_sum[u][j + 1]) + 1LL * (m - j - 1) * (d[v][i] + 1);
        }
        printf("%.10f\n", 1.0 * ans / (1.0 * n * m));
    }
}

/* <------------------------------------------------------------------------------------> */

// #define LOCAL
// #define FILE_NAME

int main()
{
    #if defined LOCAL
        freopen("input.txt", "r", stdin);
    #elif defined FILE_NAME
        freopen(FILE_NAME".in", "r", stdin);
        freopen(FILE_NAME".out", "w", stdout);
    #endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    solve();

    return 0;
}


#include <stdio.h>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <utility>

using namespace std;

#define pb push_back
#define ft first
#define sd second
#define mpr make_pair
#define all(x) begin((x)), end((x))
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define max3(a, b, c) max((a), max((b), (c)))
#define max4(a, b, c, d) max(max((a), (b)), max((c), (d)))
#define min3(a, b, c) min((a), min((b), (c)))
#define min4(a, b, c, d) min(min((a), (b)), min((c), (d)))
#define isz(x) (int)(x).size()

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef pair<int, int> pii;
typedef vector<int> vi;

/* <------------------------------------------------------------------------------------> */

const int MX = 1e5 + 7;

vector<int> g[MX], d[MX], suf_sum[MX];
int id[MX], diam[MX], mx[MX], mx1[MX], mxu[MX];
char us[MX];

map<pii, double> memo;

void dfs(int v, int p, int cnt)
{
    us[v] = true;
    id[v] = cnt;
    for (int & u : g[v]) if (u != p)
    {
        dfs(u, v, cnt);
        if (mx[v] < mx[u] + 1)
        {
            mx1[v] = mx[v];
            mx[v] = mx[u] + 1;
            mxu[v] = u;
        }
        else if (mx1[v] < mx[u] + 1)
            mx1[v] = mx[u] + 1;
    }
}

void dfs1(int v, int p, int up, int cnt)
{
    d[cnt].pb(max(up, mx[v]));
    //printf("%d: %d\n", v + 1, d[cnt].back());
    diam[cnt] = max(diam[cnt], d[cnt].back());
    for (int & u : g[v]) if (u != p)
        dfs1(u, v, max(up, (u != mxu[v] ? mx[v] : mx1[v])) + 1, cnt);
}

void init(int v, int cnt)
{
    dfs(v, -1, cnt);
    dfs1(v, -1, 0, cnt);
    sort(all(d[cnt]));
    int n = isz(d[cnt]);
    suf_sum[cnt].resize(n);
    for (int i = n - 1; i >= 0; --i)
        suf_sum[cnt][i] = d[cnt][i] + (i == n - 1 ? 0 : suf_sum[cnt][i + 1]);
}

int binsearch(vector<int> & a, int d1, int dia)
{
    int l = 0, r = isz(a) - 1;
    while (l < r)
    {
        int m = (l + r + 1) >> 1;
        if (d1 + a[m] + 1 <= dia) l = m;
        else r = m - 1;
    }
    if (d1 + a[l] + 1 <= dia) return l;
    else return -1;
}

void solve()
{
    int n, m, q;
    scanf("%d%d%d", &n, &m, &q);
    while (m--)
    {
        int v, u;
        scanf("%d%d", &v, &u);
        g[v - 1].pb(u - 1);
        g[u - 1].pb(v - 1);
    }
    int cnt = 0;
    forn (i, n) if (!us[i]) init(i, cnt++);
    while (q--)
    {
        int v, u;
        scanf("%d%d", &v, &u);
        v = id[v - 1]; u = id[u - 1];
        if (v == u)
        {
            printf("-1\n");
            continue;
        }
        if (memo.count({v, u}))
        {
            printf("%.10f\n", memo[{v, u}]);
            continue;
        }
        if (isz(d[v]) > isz(d[u])) swap(v, u);
        int n = isz(d[v]), m = isz(d[u]), dia = max(diam[v], diam[u]);
        ll ans = 0;
        forn (i, n)
        {
            int j = binsearch(d[u], d[v][i], dia);
            ans += 1LL * (j + 1) * dia + 1LL * (j == m - 1 ? 0 : suf_sum[u][j + 1]) + 1LL * (m - j - 1) * (d[v][i] + 1);
        }
        memo[{v, u}] = 1.0 * ans / (1.0 * n * m);
        printf("%.10f\n", memo[{v, u}]);
    }
}

/* <------------------------------------------------------------------------------------> */

// #define LOCAL
// #define FILE_NAME

int main()
{
    #if defined LOCAL
        freopen("input.txt", "r", stdin);
    #elif defined FILE_NAME
        freopen(FILE_NAME".in", "r", stdin);
        freopen(FILE_NAME".out", "w", stdout);
    #endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    solve();

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MN=100000;

int ht[MN],dia[MN];
int n;
vector<int> e[MN];
int con[MN];

void dfs1(int i,int p,int c)
{
  con[i]=c;
  ht[i]=0;
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    dfs1(j,i,c);
    ht[i]=max(ht[i],ht[j]+1);
  }
}

void dfs2(int i,int p,int X)
{
  int mx=0,mj,mx2=0;
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    if(ht[j]+1>mx){
      mx2=mx;
      mx=ht[j]+1;
      mj=j;
    }
    else if(ht[j]+1>mx2){
      mx2=ht[j]+1;
    }
  }
  dia[i]=max(X,mx);
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    dfs2(j,i,max(X,j==mj?mx2:mx)+1);
  }
}

int main()
{
  int m,q;
  scanf("%d%d%d",&n,&m,&q);
  for(int i=0;i<m;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    a--,b--;
    e[a].push_back(b);
    e[b].push_back(a);
  }
  for(int i=0;i<n;i++){
    con[i]=-1;
  }
  int C=0;
  for(int i=0;i<n;i++){
    if(con[i]!=-1){
      continue;
    }
    dfs1(i,-1,C);
    C++;
    dfs2(i,-1,0);
  }
  vector<int> sz(C,0),Dia(C,0);
  vector<vector<int> > dis(C);
  for(int i=0;i<n;i++){
    sz[con[i]]++;
    Dia[con[i]]=max(Dia[con[i]],dia[i]);
  }
  for(int t=0;t<C;t++){
    dis[t]=vector<int>(sz[t]+1,0);
  }
  for(int i=0;i<n;i++){
    dis[con[i]][dia[i]]++;
  }
  vector<vector<double> > sdis(C),edis(C);
  for(int t=0;t<C;t++){
    sdis[t]=vector<double>(sz[t]+2,0.);
    edis[t]=vector<double>(sz[t]+2,0.);
    sdis[t][0]=0.;
    edis[t][0]=0.;
    for(int x=0;x<=sz[t];x++){
      //printf("%d %d %d\n",t,x,dis[t][x]);
      sdis[t][x+1]=sdis[t][x]+(double)dis[t][x]/sz[t];
      edis[t][x+1]=edis[t][x]+(double)x*dis[t][x]/sz[t];
    }
  }
  map<pair<int,int>,double> memo;
  while(q--){
    int a,b;
    scanf("%d%d",&a,&b);
    a--,b--;
    a=con[a],b=con[b];
    if(a==b){
      puts("-1");
      continue;
    }
    if(sz[a]>sz[b]){
      swap(a,b);
    }
    double ans;
    if(memo.find(make_pair(a,b))!=memo.end()){
      ans=memo[make_pair(a,b)];
    }
    else{
      ans=0.;
      int D=max(Dia[a],Dia[b]);
      for(int x=0;x<=sz[a];x++){
	int Y=min(D-x,sz[b]+1);
	ans+=(double)dis[a][x]/sz[a]*(D*sdis[b][Y]+(x+1)*(sdis[b][sz[b]+1]-sdis[b][Y])+edis[b][sz[b]+1]-edis[b][Y]);
      }
      memo[make_pair(a,b)]=ans;
    }
    printf("%.8lf\n",ans);
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MN=100000;

int ht[MN],dia[MN];
int n;
vector<int> e[MN];
int con[MN];

void dfs1(int i,int p,int c)
{
  con[i]=c;
  ht[i]=0;
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    dfs1(j,i,c);
    ht[i]=max(ht[i],ht[j]+1);
  }
}

void dfs2(int i,int p,int X)
{
  int mx=0,mj,mx2=0;
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    if(ht[j]+1>mx){
      mx2=mx;
      mx=ht[j]+1;
      mj=j;
    }
    else if(ht[j]+1>mx2){
      mx2=ht[j]+1;
    }
  }
  dia[i]=max(X,mx);
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    dfs2(j,i,max(X,j==mj?mx2:mx)+1);
  }
}

int main()
{
  int m,q;
  scanf("%d%d%d",&n,&m,&q);
  for(int i=0;i<m;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    a--,b--;
    e[a].push_back(b);
    e[b].push_back(a);
  }
  for(int i=0;i<n;i++){
    con[i]=-1;
  }
  int C=0;
  for(int i=0;i<n;i++){
    if(con[i]!=-1){
      continue;
    }
    dfs1(i,-1,C);
    C++;
    dfs2(i,-1,0);
  }
  vector<int> sz(C,0),Dia(C,0);
  vector<vector<int> > dis(C);
  for(int i=0;i<n;i++){
    sz[con[i]]++;
    Dia[con[i]]=max(Dia[con[i]],dia[i]);
  }
  for(int t=0;t<C;t++){
    dis[t]=vector<int>(sz[t]+1,0);
  }
  for(int i=0;i<n;i++){
    dis[con[i]][dia[i]]++;
  }
  vector<vector<double> > sdis(C),edis(C);
  for(int t=0;t<C;t++){
    sdis[t]=vector<double>(sz[t]+2,0.);
    edis[t]=vector<double>(sz[t]+2,0.);
    sdis[t][0]=0.;
    edis[t][0]=0.;
    for(int x=0;x<=sz[t];x++){
      //printf("%d %d %d\n",t,x,dis[t][x]);
      sdis[t][x+1]=sdis[t][x]+(double)dis[t][x]/sz[t];
      edis[t][x+1]=edis[t][x]+(double)x*dis[t][x]/sz[t];
    }
  }
  map<pair<int,int>,double> memo;
  while(q--){
    int a,b;
    scanf("%d%d",&a,&b);
    a--,b--;
    a=con[a],b=con[b];
    if(a==b){
      puts("-1");
      continue;
    }
    if(sz[a]>sz[b]){
      swap(a,b);
    }
    double ans;
    if(memo.find(make_pair(a,b))!=memo.end()){
      ans=memo[make_pair(a,b)];
    }
    else{
      ans=0.;
      int D=max(Dia[a],Dia[b]);
      for(int x=0;x<=Dia[a];x++){
	int Y=min(D-x,sz[b]+1);
	ans+=(double)dis[a][x]/sz[a]*(D*sdis[b][Y]+(x+1)*(sdis[b][sz[b]+1]-sdis[b][Y])+edis[b][sz[b]+1]-edis[b][Y]);
      }
      memo[make_pair(a,b)]=ans;
    }
    printf("%.8lf\n",ans);
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MN=100000;

int ht[MN],dia[MN];
int n;
vector<int> e[MN];
int con[MN];

void dfs1(int i,int p,int c)
{
  con[i]=c;
  ht[i]=0;
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    dfs1(j,i,c);
    ht[i]=max(ht[i],ht[j]+1);
  }
}

void dfs2(int i,int p,int X)
{
  int mx=0,mj,mx2=0;
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    if(ht[j]+1>mx){
      mx2=mx;
      mx=ht[j]+1;
      mj=j;
    }
    else if(ht[j]+1>mx2){
      mx2=ht[j]+1;
    }
  }
  dia[i]=max(X,mx);
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    dfs2(j,i,max(X,j==mj?mx2:mx)+1);
  }
}

int main()
{
  int m,q;
  scanf("%d%d%d",&n,&m,&q);
  for(int i=0;i<m;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    a--,b--;
    e[a].push_back(b);
    e[b].push_back(a);
  }
  for(int i=0;i<n;i++){
    con[i]=-1;
  }
  int C=0;
  for(int i=0;i<n;i++){
    if(con[i]!=-1){
      continue;
    }
    dfs1(i,-1,C);
    C++;
    dfs2(i,-1,0);
  }
  vector<int> sz(C,0),Dia(C,0);
  vector<vector<int> > dis(C);
  for(int i=0;i<n;i++){
    sz[con[i]]++;
    Dia[con[i]]=max(Dia[con[i]],dia[i]);
  }
  for(int t=0;t<C;t++){
    dis[t]=vector<int>(sz[t]+1,0);
  }
  for(int i=0;i<n;i++){
    dis[con[i]][dia[i]]++;
  }
  vector<vector<double> > sdis(C),edis(C);
  for(int t=0;t<C;t++){
    sdis[t]=vector<double>(sz[t]+2,0.);
    edis[t]=vector<double>(sz[t]+2,0.);
    sdis[t][0]=0.;
    edis[t][0]=0.;
    for(int x=0;x<=sz[t];x++){
      //printf("%d %d %d\n",t,x,dis[t][x]);
      sdis[t][x+1]=sdis[t][x]+(double)dis[t][x]/sz[t];
      edis[t][x+1]=edis[t][x]+(double)x*dis[t][x]/sz[t];
    }
  }
  map<pair<int,int>,double> memo;
  while(q--){
    int a,b;
    scanf("%d%d",&a,&b);
    a--,b--;
    a=con[a],b=con[b];
    if(a==b){
      puts("-1");
      continue;
    }
    if(sz[a]>sz[b]){
      swap(a,b);
    }
    double ans;
    if(memo.find(make_pair(a,b))!=memo.end()){
      ans=memo[make_pair(a,b)];
    }
    else{
      ans=0.;
      int D=max(Dia[a],Dia[b]);
      for(int x=0;x<=D;x++){
	int Y=min(D-x,sz[b]+1);
	ans+=(double)dis[a][x]/sz[a]*(D*sdis[b][Y]+(x+1)*(sdis[b][sz[b]+1]-sdis[b][Y])+edis[b][sz[b]+1]-edis[b][Y]);
      }
      memo[make_pair(a,b)]=ans;
    }
    printf("%.8lf\n",ans);
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int MN=100000;

int ht[MN],dia[MN];
int n;
vector<int> e[MN];
int con[MN];

void dfs1(int i,int p,int c)
{
  con[i]=c;
  ht[i]=0;
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    dfs1(j,i,c);
    ht[i]=max(ht[i],ht[j]+1);
  }
}

void dfs2(int i,int p,int X)
{
  int mx=0,mj,mx2=0;
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    if(ht[j]+1>mx){
      mx2=mx;
      mx=ht[j]+1;
      mj=j;
    }
    else if(ht[j]>1>mx2){
      mx2=ht[j]+1;
    }
  }
  dia[i]=max(X,mx);
  for(int x=0;x<e[i].size();x++){
    int j=e[i][x];
    if(j==p)continue;
    dfs2(j,i,max(X,j==mj?mx2:mx)+1);
  }
}

int main()
{
  int m,q;
  scanf("%d%d%d",&n,&m,&q);
  for(int i=0;i<m;i++){
    int a,b;
    scanf("%d%d",&a,&b);
    a--,b--;
    e[a].push_back(b);
    e[b].push_back(a);
  }
  for(int i=0;i<n;i++){
    con[i]=-1;
  }
  int C=0;
  for(int i=0;i<n;i++){
    if(con[i]!=-1){
      continue;
    }
    dfs1(i,-1,C);
    C++;
    dfs2(i,-1,0);
  }
  vector<int> sz(C,0),Dia(C,0);
  vector<vector<int> > dis(C);
  for(int i=0;i<n;i++){
    sz[con[i]]++;
    Dia[con[i]]=max(Dia[con[i]],dia[i]);
  }
  for(int t=0;t<C;t++){
    dis[t]=vector<int>(sz[t]+1,0);
  }
  for(int i=0;i<n;i++){
    dis[con[i]][dia[i]]++;
    Dia[con[i]]=max(Dia[con[i]],dia[i]);
  }
  vector<vector<double> > sdis(C),edis(C);
  for(int t=0;t<C;t++){
    sdis[t]=vector<double>(sz[t]+2,0.);
    edis[t]=vector<double>(sz[t]+2,0.);
    sdis[t][0]=0.;
    edis[t][0]=0.;
    for(int x=0;x<=sz[t];x++){
      //printf("%d %d %d\n",t,x,dis[t][x]);
      sdis[t][x+1]=sdis[t][x]+(double)dis[t][x]/sz[t];
      edis[t][x+1]=edis[t][x]+(double)x*dis[t][x]/sz[t];
    }
  }
  map<pair<int,int>,double> memo;
  while(q--){
    int a,b;
    scanf("%d%d",&a,&b);
    a--,b--;
    a=con[a],b=con[b];
    if(a==b){
      puts("-1");
      continue;
    }
    if(sz[a]>sz[b]){
      swap(a,b);
    }
    double ans;
    if(memo.find(make_pair(a,b))!=memo.end()){
      ans=memo[make_pair(a,b)];
    }
    else{
      ans=0.;
      int D=max(Dia[a],Dia[b]);
      for(int x=0;x<=sz[a];x++){
	int Y=min(D-x,sz[b]+1);
	ans+=(double)dis[a][x]/sz[a]*(D*sdis[b][Y]+(x+1)*(sdis[b][sz[b]+1]-sdis[b][Y])+edis[b][sz[b]+1]-edis[b][Y]);
      }
      memo[make_pair(a,b)]=ans;
    }
    printf("%.8lf\n",ans);
  }
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int N, M, Q;
vector<int> V[100005];
int C[100005], k;
int Dp[100005];
long long can[100005];
long long sum[100005];

void Dfs( int nod, int pad ){
   C[nod] = k;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     Dfs( i, nod );
     Dp[nod] = max( Dp[i]+1, Dp[nod] );
   }
}

void Dfs1( int nod, int pad, int cost ){
   int my1 = 0, my2 = 0;
   for( auto i : V[nod] ){
       if( i == pad ) continue;
       if( my1 < Dp[i]+1 ){
        my2 = my1;
        my1 = Dp[i]+1;
       }else
       if( my2 < Dp[i]+1 )
        my2 = Dp[i]+1;
   }

   Dp[nod] = max( Dp[nod], cost );

   int my;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     my = max( ( my1 == Dp[i]+1 )?my2:my1, cost );
     Dfs1( i, nod, my+1 );
   }
}

int main () {
    #ifdef acm
    freopen("a.in", "r", stdin);
    #endif // acm

    cin.tie();
    ios_base::sync_with_stdio(0);

    cin >> N >> M >> Q;

    int a, b;
    for( int i = 0; i < M; i ++ ){
        cin >> a >> b;
        V[a].push_back( b );
        V[b].push_back( a );
    }

    for( int i = 1; i <= N; i ++ )
        if( !C[i] ){
            k ++;
            Dfs( i, -1 );
            Dfs1( i, -1, 0 );
        }

    for( int i= 1; i <= N; i ++ ){
        can[C[i]] ++;
        sum[C[i]] += 1ll*Dp[i];
    }

    for( int i = 1; i <= Q; i ++ ){
        cin >> a >> b;
        if( C[a] == C[b] ){
            cout << -1 << '\n';
            continue;
        }
        a = C[a];
        b = C[b];
        double v0 = (1.0*sum[a]*can[b]+1.0*sum[b]*can[a])/(1.0*can[a]*can[b]);
        //double v1 = ()/(1.0*can[a]*can[b]);

        cout << fixed << setprecision(10) << v0+1.0 << '\n';
    }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int N, M, Q;
vector<int> V[100005];
vector<long long> G[100005];
vector<long long> G1[100005];
int C[100005], k;
int L[100005];
int Dp[100005];
long long can[100005];
long long sum[100005];
long long may[100005];

void Dfs( int nod, int pad ){
   C[nod] = k;
   L[nod] = 0;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     Dfs( i, nod );
     L[nod] = max( L[i]+1, L[nod] );
   }
}

void Dfs1( int nod, int pad, int cost ){
   int my1 = 0, my2 = 0;
   for( auto i : V[nod] ){
       if( i == pad ) continue;
       if( my1 < L[i]+1 ){
        my2 = my1;
        my1 = L[i]+1;
       }else
       if( my2 < L[i]+1 )
        my2 = L[i]+1;
   }

   Dp[nod] = max( my1, cost );

   int my;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     my = max( ( my1 == L[i]+1 )?my2:my1, cost );
     Dfs1( i, nod, my+1 );
   }
}

typedef pair<int, int> par;
map<par, long double> MM;
long double calc( int a, int b ){
  if( can[a] > can[b] ) swap( a, b );
  if( can[a] == can[b] && a > b ) swap( a, b );

  if( MM.find( par( a, b ) ) != MM.end() ){
    return MM[par( a, b )];
  }

  long long y = max( may[a], may[b] );
  long double sol = 0;

  for( int i = 1; i < G[a].size(); i ++ ){
     long long v = G[a][i];
     int up = upper_bound( G[b].begin(), G[b].end(), y - v - 1 ) - G[b].begin();
     int t = G[b].size()-1;
     long long w = G1[b][t], r = G1[b][up-1];
     sol += (y*(up-1)+( w - r) + (1ll+v)*(t-up+1));
  }
  sol /=(can[a]*can[b]);
  return MM[par( a, b )] = sol;
}

int main () {
    #ifdef acm
    freopen("a.in", "r", stdin);
    #endif // acm

    cin.tie();
    ios_base::sync_with_stdio(0);

    cin >> N >> M >> Q;

    int a, b;
    for( int i = 0; i < M; i ++ ){
        cin >> a >> b;
        V[a].push_back( b );
        V[b].push_back( a );
    }

    for( int i = 1; i <= N; i ++ )
        if( !C[i] ){
            k ++;
            Dfs( i, -1 );
            Dfs1( i, -1, 0 );
        }

    for( int i= 1; i <= N; i ++ ){
        can[C[i]] ++;
        sum[C[i]] += 1ll*Dp[i];
        may[C[i]] = max( may[C[i]], 1ll*Dp[i]);
        G[C[i]].push_back( 1ll*Dp[i] );
    }

    for( int i = 1; i <= k; i ++ ){
        G[i].push_back( 0 );
        sort( G[i].begin(), G[i].end() );
        long long s = 0;
        for( auto j : G[i] ){
            s += j;
            G1[i].push_back( s );
        }
    }

    for( int i = 1; i <= Q; i ++ ){
        cin >> a >> b;
        if( C[a] == C[b] ){
            cout << -1 << '\n';
            continue;
        }
        a = C[a];
        b = C[b];

        long double sol = calc( a, b );

        cout << fixed << setprecision(9) << sol << '\n';
    }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int N, M, Q;
vector<int> V[100005];
int C[100005], k;
int Dp[100005];
long long can[100005];
long long sum[100005];

void Dfs( int nod, int pad ){
   C[nod] = k;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     Dfs( i, nod );
     Dp[nod] = max( Dp[i]+1, Dp[nod] );
   }
}

void Dfs1( int nod, int pad, int cost ){
   int my1 = 0, my2 = 0;
   for( auto i : V[nod] ){
       if( i == pad ) continue;
       if( my1 < Dp[i]+1 ){
        my2 = my1;
        my1 = Dp[i]+1;
       }else
       if( my2 < Dp[i]+1 )
        my2 = Dp[i]+1;
   }

   Dp[nod] = max( Dp[nod], cost );

   int my;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     my = max( ( my1 == Dp[i]+1 )?my2:my1, cost );
     Dfs1( i, nod, my+1 );
   }
}

int main () {
    #ifdef acm
    freopen("a.in", "r", stdin);
    #endif // acm

    cin.tie();
    ios_base::sync_with_stdio(0);

    cin >> N >> M >> Q;

    int a, b;
    for( int i = 0; i < M; i ++ ){
        cin >> a >> b;
        V[a].push_back( b );
        V[b].push_back( a );
    }

    for( int i = 1; i <= N; i ++ )
        if( !C[i] ){
            k ++;
            Dfs( i, -1 );
            Dfs1( i, -1, 0 );
        }

    for( int i= 1; i <= N; i ++ ){
        can[C[i]] ++;
        sum[C[i]] += 1ll*Dp[i];
    }

    for( int i = 1; i <= Q; i ++ ){
        cin >> a >> b;
        if( C[a] == C[b] ){
            cout << -1 << '\n';
            continue;
        }
        a = C[a];
        b = C[b];
        double v0 = (1.0*sum[a]*can[b])/(1.0*can[a]*can[b]);
        double v1 = (1.0*sum[b]*can[a])/(1.0*can[a]*can[b]);

        cout << fixed << setprecision(10) << v0+v1+1.0 << '\n';
    }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int N, M, Q;
vector<int> V[100005];
int C[100005], k;
int L[100005];
int Dp[100005];
long long can[100005];
long long sum[100005];

void Dfs( int nod, int pad ){
   C[nod] = k;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     Dfs( i, nod );
     L[nod] = max( L[i]+1, L[nod] );
   }
}

void Dfs1( int nod, int pad, int cost ){
   int my1 = 0, my2 = 0;
   for( auto i : V[nod] ){
       if( i == pad ) continue;
       if( my1 < L[i]+1 ){
        my2 = my1;
        my1 = L[i]+1;
       }else
       if( my2 < L[i]+1 )
        my2 = L[i]+1;
   }

   Dp[nod] = max( my1, cost );

   int my;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     my = max( ( my1 == L[i]+1 )?my2:my1, cost );
     Dfs1( i, nod, my+1 );
   }
}

int main () {
    #ifdef acm
    freopen("a.in", "r", stdin);
    #endif // acm

    cin.tie();
    ios_base::sync_with_stdio(0);

    cin >> N >> M >> Q;

    int a, b;
    for( int i = 0; i < M; i ++ ){
        cin >> a >> b;
        V[a].push_back( b );
        V[b].push_back( a );
    }

    for( int i = 1; i <= N; i ++ )
        if( !C[i] ){
            k ++;
            Dfs( i, -1 );
            Dfs1( i, -1, 0 );
        }

    for( int i= 1; i <= N; i ++ ){
        can[C[i]] ++;
        sum[C[i]] += 1ll*Dp[i];
    }

    for( int i = 1; i <= Q; i ++ ){
        cin >> a >> b;
        if( C[a] == C[b] ){
            cout << -1 << '\n';
            continue;
        }
        a = C[a];
        b = C[b];
        double v0 =  (1.0*sum[a])/(1.0*can[a]);
        double v1 =  (1.0*sum[b])/(1.0*can[b]);

        ///double v0 = (1.0*sum[a]*can[b]+1.0*sum[b]*can[a])/(1.0*can[a]*can[b]);
        //double v1 = ()/(1.0*can[a]*can[b]);

        cout << fixed << setprecision(10) << v0+v1+1.0 << '\n';
    }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int N, M, Q;
vector<int> V[100005];
int C[100005], k;
int L[100005];
int Dp[100005];
long long can[100005];
long long sum[100005];

void Dfs( int nod, int pad ){
   C[nod] = k;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     Dfs( i, nod );
     L[nod] = max( L[i]+1, L[nod] );
   }
}

void Dfs1( int nod, int pad, int cost ){
   int my1 = 0, my2 = 0;
   for( auto i : V[nod] ){
       if( i == pad ) continue;
       if( my1 < L[i]+1 ){
        my2 = my1;
        my1 = L[i]+1;
       }else
       if( my2 < L[i]+1 )
        my2 = L[i]+1;
   }

   Dp[nod] = max( my1, cost );

   int my;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     my = max( ( my1 == L[i]+1 )?my2:my1, cost );
     Dfs1( i, nod, my+1 );
   }
}

int main () {
    #ifdef acm
    freopen("a.in", "r", stdin);
    #endif // acm

    cin.tie();
    ios_base::sync_with_stdio(0);

    cin >> N >> M >> Q;

    int a, b;
    for( int i = 0; i < M; i ++ ){
        cin >> a >> b;
        V[a].push_back( b );
        V[b].push_back( a );
    }

    for( int i = 1; i <= N; i ++ )
        if( !C[i] ){
            k ++;
            Dfs( i, -1 );
            Dfs1( i, -1, 0 );
        }

    for( int i= 1; i <= N; i ++ ){
        can[C[i]] ++;
        sum[C[i]] += 1ll*Dp[i];
    }

    for( int i = 1; i <= Q; i ++ ){
        cin >> a >> b;
        if( C[a] == C[b] ){
            cout << -1 << '\n';
            continue;
        }
        a = C[a];
        b = C[b];
        long double v0 =  (1.0*sum[a])/(1.0*can[a]);
        long double v1 =  (1.0*sum[b])/(1.0*can[b]);

        ///double v0 = (1.0*sum[a]*can[b]+1.0*sum[b]*can[a])/(1.0*can[a]*can[b]);
        //double v1 = ()/(1.0*can[a]*can[b]);

        cout << fixed << setprecision(7) << v0+v1+1.0 << '\n';
    }

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int N, M, Q;
vector<int> V[100005];
vector<long long> G[100005];
vector<long long> G1[100005];
int C[100005], k;
int L[100005];
int Dp[100005];
long long can[100005];
long long sum[100005];
long long may[100005];

void Dfs( int nod, int pad ){
   C[nod] = k;
   L[nod] = 0;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     Dfs( i, nod );
     L[nod] = max( L[i]+1, L[nod] );
   }
}

void Dfs1( int nod, int pad, int cost ){
   int my1 = 0, my2 = 0;
   for( auto i : V[nod] ){
       if( i == pad ) continue;
       if( my1 < L[i]+1 ){
        my2 = my1;
        my1 = L[i]+1;
       }else
       if( my2 < L[i]+1 )
        my2 = L[i]+1;
   }

   Dp[nod] = max( my1, cost );

   int my;
   for( auto i : V[nod] ){
     if( i == pad ) continue;
     my = max( ( my1 == L[i]+1 )?my2:my1, cost );
     Dfs1( i, nod, my+1 );
   }
}

typedef pair<int, int> par;
map<par, long double> MM;
long double calc( int a, int b ){
  if( can[a] > can[b] ) swap( a, b );
  if( can[a] == can[b] && a > b ) swap( a, b );

  if( MM.find( par( a, b ) ) != MM.end() ){
    return MM[par( a, b )];
  }

  long long y = max( may[a], may[b] );
  long double sol = 0;

  for( int i = 1; i < G[a].size(); i ++ ){
     long long v = G[a][i];
     int up = upper_bound( G[b].begin(), G[b].end(), y - v - 1 ) - G[b].begin();
     if( up == 0 ) up = 1;
     int t = G[b].size()-1;
     long long w = G1[b][t], r = G1[b][up-1];
     sol += (y*(up-1)+( w - r) + (1ll+v)*(t-up+1));
  }
  sol /=(can[a]*can[b]);
  return MM[par( a, b )] = sol;
}

int main () {
    #ifdef acm
    freopen("a.in", "r", stdin);
    #endif // acm

    cin.tie();
    ios_base::sync_with_stdio(0);

    cin >> N >> M >> Q;

    int a, b;
    for( int i = 0; i < M; i ++ ){
        cin >> a >> b;
        V[a].push_back( b );
        V[b].push_back( a );
    }

    for( int i = 1; i <= N; i ++ )
        if( !C[i] ){
            k ++;
            Dfs( i, -1 );
            Dfs1( i, -1, 0 );
        }

    for( int i= 1; i <= N; i ++ ){
        can[C[i]] ++;
        sum[C[i]] += 1ll*Dp[i];
        may[C[i]] = max( may[C[i]], 1ll*Dp[i]);
        G[C[i]].push_back( 1ll*Dp[i] );
    }

    for( int i = 1; i <= k; i ++ ){
        G[i].push_back( 0 );
        sort( G[i].begin(), G[i].end() );
        long long s = 0;
        for( auto j : G[i] ){
            s += j;
            G1[i].push_back( s );
        }
    }

    for( int i = 1; i <= Q; i ++ ){
        cin >> a >> b;
        if( C[a] == C[b] ){
            cout << -1 << '\n';
            continue;
        }
        a = C[a];
        b = C[b];

        long double sol = calc( a, b );

        cout << fixed << setprecision(9) << sol << '\n';
    }

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << ", ";
#define endln cerr << "\n";
#define chkpt cerr << "-----\n";

const int maxn = 1e6 + 5;
int n, m, q;
vi adj[maxn];
int ptr;
int f[maxn];
int from[maxn];
int add;
int size[maxn];
long long sum[maxn];

int diameter;
pi best;
void dfs(int u, int p, int d) {
    chkmax(best, mp(d, u));
    f[u] = ptr;
    FOR(i, 0, sz(adj[u])) {
        int v = adj[u][i];
        if (v != p) {
            from[v] = u;
            dfs(v, u, d + 1);
        }
    }
}

void upd(int u, int p, int d) {
    size[ptr]++;
    sum[ptr] += d + diameter / 2;
    FOR(i, 0, sz(adj[u])) {
        int v = adj[u][i];
        if (v != p) {
            upd(v, u, d + 1);
        }
    }
}

void findcenter(int u) {
    best = mp(0, 0), dfs(u, -1, 0);
    int st = best.se;
    best = mp(0, 0), dfs(st, -1, 0);
    int ed = best.se;
    vi path;
    while (ed != st) {
        path.pb(ed);
        ed = from[ed];
    }
    path.pb(st);
    diameter = sz(path) - 1;
    if (sz(path) & 1) {
        upd(path[sz(path) / 2], -1, 0);
    }
    else {
        int x = path[sz(path) / 2 - 1];
        int y = path[sz(path) / 2];
        upd(x, y, 1), upd(y, x, 1);
    }
}

void solve() {
    cin >> n >> m >> q;
    FOR(i, 0, m) {
        int u, v; cin >> u >> v; u--, v--;
        adj[u].pb(v), adj[v].pb(u);
    }
    FOR(i, 0, n) if (!f[i]) {
        ptr++;
        findcenter(i);
    }
    while (q--) {
        int u, v; cin >> u >> v; u--, v--;
        int x = f[u];
        int y = f[v];
        if (x == y) {
            cout << -1 << "\n";
        }
        else {
            cout << prec(9) << (ld) sum[x] / size[x] + (ld) sum[y] / size[y] + 1 << "\n";
        }
    }
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        JUDGE_ONLINE = 0;
        assert(freopen("in.txt", "r", stdin));
        //assert(freopen("out.txt", "w", stdout));
    }
    else {
        ios_base::sync_with_stdio(0), cin.tie(0);
    }
    solve();
    if (!JUDGE_ONLINE) {
        //cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << ", ";
#define endln cerr << "\n";
#define chkpt cerr << "-----\n";

#define double long double
const int maxn = 1e6 + 5;
int n, m, q;
vi adj[maxn];
int ptr;
int f[maxn];
int from[maxn];
int add;
int size[maxn];
double sum[maxn];

pi best;
void dfs(int u, int p, int d) {
    chkmax(best, mp(d, u));
    f[u] = ptr;
    FOR(i, 0, sz(adj[u])) {
        int v = adj[u][i];
        if (v != p) {
            from[v] = u;
            dfs(v, u, d + 1);
        }
    }
}

double cof;
double diameter;
int findcenter(int u) {
    best = mp(0, 0), dfs(u, -1, 0);
    int st = best.se;
    best = mp(0, 0), dfs(st, -1, 0);
    int ed = best.se;
    vi path;
    while (ed != st) {
        path.pb(ed);
        ed = from[ed];
    }
    path.pb(st);
    diameter = (sz(path) - 1) * 0.5;
    if (sz(path) & 1) {
        cof = 1.0;
        return path[sz(path) / 2];
    }
    else {
        int x = path[sz(path) / 2 - 1];
        int y = path[sz(path) / 2];
        FOR(i, 0, sz(adj[x])) {
            if (adj[x][i] == y) {
                adj[x].erase(adj[x].begin() + i);
                break;
            }
        }
        FOR(i, 0, sz(adj[y])) {
            if (adj[y][i] == x) {
                adj[y].erase(adj[y].begin() + i);
                break;
            }
        }
        adj[add].pb(x);
        adj[add].pb(y);
        cof = 0.5;
        return add++;
    }
}

void upd(int u, int p, double d) {
    if (u < n) {
        size[ptr]++;
        sum[ptr] += d + diameter;
    }
    FOR(i, 0, sz(adj[u])) {
        int v = adj[u][i];
        if (v != p) {
            double nd = d;
            if (cof == 1) nd++;
            else {
                if (p == -1) nd += 0.5;
                else nd++;
            }
            upd(v, u, nd);
        }
    }
}

void solve() {
    cin >> n >> m >> q;
    FOR(i, 0, m) {
        int u, v; cin >> u >> v; u--, v--;
        adj[u].pb(v), adj[v].pb(u);
    }
    add = n;
    FOR(i, 0, n) if (!f[i]) {
        ptr++;
        int cen = findcenter(i);
        upd(cen, -1, 0);
    }
    while (q--) {
        int u, v; cin >> u >> v; u--, v--;
        if (f[u] == f[v]) {
            cout << -1 << "\n";
        }
        else {
            int x = f[u];
            int y = f[v];
            cout << prec(9) << (sum[x] / size[x]) + (sum[y] / size[y]) + 1 << "\n";
        }
    }
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        JUDGE_ONLINE = 0;
        assert(freopen("in.txt", "r", stdin));
        //assert(freopen("out.txt", "w", stdout));
    }
    else {
//        ios_base::sync_with_stdio(0), cin.tie(0);
    }
    solve();
    if (!JUDGE_ONLINE) {
        //cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << ", ";
#define endln cerr << "\n";
#define chkpt cerr << "-----\n";

const int maxn = 1e5 + 5;
int n, m, q;
vi adj[maxn];
int ptr;
int f[maxn];
int from[maxn];
int size[maxn];
long long sum[maxn];
int g[maxn];
vi v[maxn];
vector<long long> vv[maxn];

pi best;
void dfs(int u, int p, int d) {
    chkmax(best, mp(d, u));
    f[u] = ptr;
    FOR(i, 0, sz(adj[u])) {
        int v = adj[u][i];
        if (v != p) {
            from[v] = u;
            dfs(v, u, d + 1);
        }
    }
}

void upd(int u, int p, int d) {
    size[ptr]++;
    sum[ptr] += d + g[ptr] / 2;
    v[ptr].pb(d + g[ptr] / 2);
    FOR(i, 0, sz(adj[u])) {
        int v = adj[u][i];
        if (v != p) {
            upd(v, u, d + 1);
        }
    }
}

void findcenter(int u) {
    best = mp(0, 0), dfs(u, -1, 0);
    int st = best.se;
    best = mp(0, 0), dfs(st, -1, 0);
    int ed = best.se;
    vi path;
    while (ed != st) {
        path.pb(ed);
        ed = from[ed];
    }
    path.pb(st);
    g[ptr] = sz(path) - 1;
    if (sz(path) & 1) {
        upd(path[sz(path) / 2], -1, 0);
    }
    else {
        int x = path[sz(path) / 2 - 1];
        int y = path[sz(path) / 2];
        upd(x, y, 1), upd(y, x, 1);
    }
}

map<int, ld> hs[maxn];

ld func(int x, int y) {
    if (hs[x].count(y)) return hs[x][y];
    ld& res = hs[x][y];
    FOR(i, 0, sz(v[x])) {
        int val = v[x][i];
        int mx = max(g[x], g[y]);
        int k = upper_bound(all(v[y]), mx - val - 1) - v[y].begin();
        if (k) {
            res -= (ld) val * k;
            res -= vv[y][k - 1];
            res += (ld) k * (mx - 1);
        }
    }
    return res;
}

void solve() {
    cin >> n >> m >> q;
    FOR(i, 0, m) {
        int u, v; cin >> u >> v; u--, v--;
        adj[u].pb(v), adj[v].pb(u);
    }
    FOR(i, 0, n) if (!f[i]) {
        ptr++;
        findcenter(i);
        sort(all(v[ptr]));
        long long tot = 0;
        FOR(j, 0, sz(v[ptr])) {
            tot += v[ptr][j];
            vv[ptr].pb(tot);
        }
    }
    FOR(i, 0, q) {
        int x, y; cin >> x >> y; x--, y--;
        x = f[x], y = f[y];
        if (x != y) {
            ld ans = (ld) sum[x] / size[x] + (ld) sum[y] / size[y];
            if (mp(sz(v[x]), x) > mp(sz(v[y]), y)) {
                swap(x, y);
            }
            ans += func(x, y) / size[x] / size[y];
            cout << prec(9) << ans + 1 << "\n";
        }
        else {
            cout << -1 << "\n";
        }
    }
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        JUDGE_ONLINE = 0;
        assert(freopen("in.txt", "r", stdin));
        //assert(freopen("out.txt", "w", stdout));
    }
    else {
        ios_base::sync_with_stdio(0), cin.tie(0);
    }
    solve();
    if (!JUDGE_ONLINE) {
        //cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << ", ";
#define endln cerr << "\n";
#define chkpt cerr << "-----\n";

const int maxn = 1e6 + 5;
int n, m, q;
vi adj[maxn];
int ptr;
int f[maxn];
int from[maxn];
int size[maxn];
long long sum[maxn];
int g[maxn];
vi v[maxn];
vector<long long> vv[maxn];

int diameter;
pi best;
void dfs(int u, int p, int d) {
    chkmax(best, mp(d, u));
    f[u] = ptr;
    FOR(i, 0, sz(adj[u])) {
        int v = adj[u][i];
        if (v != p) {
            from[v] = u;
            dfs(v, u, d + 1);
        }
    }
}

void upd(int u, int p, int d) {
    size[ptr]++;
    sum[ptr] += d + diameter / 2;
    v[ptr].pb(d + d + diameter / 2);
    FOR(i, 0, sz(adj[u])) {
        int v = adj[u][i];
        if (v != p) {
            upd(v, u, d + 1);
        }
    }
}

long double ans[maxn];

void findcenter(int u) {
    best = mp(0, 0), dfs(u, -1, 0);
    int st = best.se;
    best = mp(0, 0), dfs(st, -1, 0);
    int ed = best.se;
    vi path;
    while (ed != st) {
        path.pb(ed);
        ed = from[ed];
    }
    path.pb(st);
    g[ptr] = diameter = sz(path) - 1;
    if (sz(path) & 1) {
        upd(path[sz(path) / 2], -1, 0);
    }
    else {
        int x = path[sz(path) / 2 - 1];
        int y = path[sz(path) / 2];
        upd(x, y, 1), upd(y, x, 1);
    }
}

map<int, ld> hs[maxn];

ld func(int x, int y) {
    if (hs[x].count(y)) return hs[x][y];
    ld& res = hs[x][y];
    FOR(i, 0, sz(v[x])) {
        int val = v[x][i];
        int mx = max(g[x], g[y]);
        int k = upper_bound(all(v[y]), mx - val - 1) - v[y].begin();
        if (k) {
            res -= (ld) val * k;
            res -= vv[y][k - 1];
            res += k * (max(g[x], g[y]) - 1);
        }
    }
    return res;
}

void solve() {
    cin >> n >> m >> q;
    FOR(i, 0, m) {
        int u, v; cin >> u >> v; u--, v--;
        adj[u].pb(v), adj[v].pb(u);
    }
    FOR(i, 0, n) if (!f[i]) {
        ptr++;
        findcenter(i);
        sort(all(v[ptr]));
        long long tot = 0;
        FOR(j, 0, sz(v[ptr])) {
            tot += v[ptr][j];
            vv[ptr].pb(tot);
        }
    }
    FOR(i, 0, q) {
        int x, y; cin >> x >> y; x--, y--;
        x = f[x];
        y = f[y];
        if (x != y) {
            ans[i] = (ld) sum[x] / size[x] + (ld) sum[y] / size[y];
            if (mp(sz(v[x]), x) > mp(sz(v[y]), y)) {
                swap(x, y);
            }
            ans[i] += func(x, y);
            cout << prec(9) << ans[i] + 1 << "\n";
        }
        else {
            cout << -1 << "\n";
        }
    }
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        JUDGE_ONLINE = 0;
        assert(freopen("in.txt", "r", stdin));
        //assert(freopen("out.txt", "w", stdout));
    }
    else {
        ios_base::sync_with_stdio(0), cin.tie(0);
    }
    solve();
    if (!JUDGE_ONLINE) {
        //cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int maxn = 3e5 + 5;
typedef long long ll;
typedef long double ld;
int n, vis[maxn], dep[maxn], cmp[maxn];
vector <int> e[maxn], diam[maxn];
vector <ll> pdiam[maxn];
void dfs1 (int u, int p) {
	vis[u] = 1;
	for (auto v: e[u]) if (v != p) {
		dfs1(v, u);
		dep[u] = max(dep[u], dep[v] + 1);
	}
}
void dfs2 (int u, int p, int c, int mx) {
	cmp[u] = c;
	int d = max(dep[u], mx);
	// cout << u << ": " << p << " " << c << " " << diam << endl;
	diam[c].pb(d);
	multiset<int> ss;
	for (auto v: e[u]) if (v != p) {
		ss.insert(dep[v]);
	}
	for (auto v: e[u]) if (v != p) {
		ss.erase(ss.find(dep[v]));
		int cmx = mx + 1;
		if (!ss.empty()) cmx = max(cmx, *ss.rbegin() + 2);
		ss.insert(dep[v]);
		dfs2(v, u, c, cmx);
	}
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int m, q; cin >> n >> m >> q;
	while (m--) {
		int u, v; cin >> u >> v;
		e[u].pb(v); e[v].pb(u);
	}
	for (int i = 1; i <= n; i++) if (!vis[i]) {
		dfs1(i, 0); dfs2(i, 0, i, 0);
		sort(diam[i].begin(), diam[i].end());
		ll cur = 0; pdiam[i].pb(cur);
		for (int j = diam[i].size()-1; j >= 0; j--) {
			cur += diam[i][j];
			pdiam[i].pb(cur);
		}
	}
	cout << fixed << setprecision(10);
	while (q--) {
		int u, v; cin >> u >> v;
		if (cmp[u] == cmp[v]) cout << "-1\n";
		else {
			int cu = cmp[u], cv = cmp[v];
			int su = diam[cu].size(), sv = diam[cv].size();
			int mxdiam = max(diam[cu].back(), diam[cv].back());
			ll sum = 0;
			for (int i = 0; i < diam[cu].size(); i++) {
				int curdiam = diam[cu][i];
				int cut = mxdiam - 1 - curdiam;
				int j = lower_bound(diam[cv].begin(), diam[cv].end(), cut) - diam[cv].begin();
				sum += j * 1ll * mxdiam;
				int k = sv - j;
				sum += k * 1ll * (curdiam + 1) + pdiam[cv][k];
			}
			ld ans = (ld) sum / (ld) (su * 1ll * sv);
			cout << ans << "\n";
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int maxn = 1e5 + 5;
typedef long long ll;
typedef double ld;
bool vis[maxn];
int n, who, val, dep[maxn], dist1[maxn], dist2[maxn], cmp[maxn];
vector <int> e[maxn], rcmp[maxn], diam[maxn];
vector <ll> pdiam[maxn];
void dfs1 (int u, int p, int c, int dist[]) {
	vis[u] = 1; cmp[u] = c; rcmp[c].pb(u);
	dist[u] = p ? dist[p] + 1 : 0;
	if (dist[u] > val) {
		val = dist[u]; who = u;
	}
	for (auto v: e[u]) if (v != p) {
		dfs1(v, u, c, dist);
		dep[u] = max(dep[u], dep[v] + 1);
	}
}
void dfs2 (int u, int p, int dist[]) {
	vis[u] = 1;
	dist[u] = p ? dist[p] + 1 : 0;
	if (dist[u] > val) {
		val = dist[u]; who = u;
	}
	for (auto v: e[u]) if (v != p) {
		dfs2(v, u, dist);
	}
}
int main(){
	int m, q;
	scanf("%d %d %d", &n, &m, &q);
	while (m--) {
		int u, v;
		scanf("%d %d", &u, &v);
		e[u].pb(v); e[v].pb(u);
	}
	for (int i = 1; i <= n; i++) if (!vis[i]) {
		who = i, val = 0;
		dfs1(i, 0, i, dist1);
		val = 0;
		dfs2(who, 0, dist1);
		val = 0;
		dfs2(who, 0, dist2);
		for (auto u: rcmp[i]) diam[i].pb(max(dist1[u], dist2[u]));
		sort(diam[i].begin(), diam[i].end());
		ll cur = 0; pdiam[i].pb(cur);
		for (int j = diam[i].size()-1; j >= 0; j--) {
			cur += diam[i][j];
			pdiam[i].pb(cur);
		}
	}

	unordered_map <ll, ld> memo;
	while (q--) {
		int u, v; scanf("%d %d", &u, &v);
		int cu = cmp[u], cv = cmp[v];
		int su = diam[cu].size(), sv = diam[cv].size();
		if (su > sv) swap (u, v), swap(cu, cv), swap (su, sv);
		if (cu == cv) printf("-1\n");
		else {
			ld ans; ll id = u*1ll*maxn + v;
			if (!memo.count(id)) {
				int mxdiam = max(diam[cu].back(), diam[cv].back());
				ll sum = 0;
				for (int i = 0; i < su; i++) {
					int curdiam = diam[cu][i];
					int cut = mxdiam - 1 - curdiam;
					int j = lower_bound(diam[cv].begin(), diam[cv].end(), cut) - diam[cv].begin();
					sum += j * 1ll * mxdiam;
					int k = sv - j;
					sum += k * 1ll * (curdiam + 1) + pdiam[cv][k];
				}
				ans = (ld) sum / (ld) (su * 1ll * sv);
				memo[id] = ans;
			} else ans = memo[id];
			printf("%0.8lf\n", ans);
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int maxn = 1e5 + 5;
typedef long long ll;
typedef double ld;
int n, vis[maxn], dep[maxn], cmp[maxn];
vector <int> e[maxn], diam[maxn];
vector <ll> pdiam[maxn];
void dfs1 (int u, int p) {
	vis[u] = 1;
	for (auto v: e[u]) if (v != p) {
		dfs1(v, u);
		dep[u] = max(dep[u], dep[v] + 1);
	}
}
void dfs2 (int u, int p, int c, int mx) {
	cmp[u] = c;
	int d = max(dep[u], mx);
	// cout << u << ": " << p << " " << c << " " << diam << endl;
	diam[c].pb(d);
	multiset<int> ss;
	for (auto v: e[u]) if (v != p) {
		ss.insert(dep[v]);
	}
	for (auto v: e[u]) if (v != p) {
		ss.erase(ss.find(dep[v]));
		int cmx = mx + 1;
		if (!ss.empty()) cmx = max(cmx, *ss.rbegin() + 2);
		ss.insert(dep[v]);
		dfs2(v, u, c, cmx);
	}
}
int main(){
	int m, q; scanf("%d %d %d", &n, &m, &q);
	while (m--) {
		int u, v; scanf("%d %d", &u, &v);
		e[u].pb(v); e[v].pb(u);
	}
	for (int i = 1; i <= n; i++) if (!vis[i]) {
		dfs1(i, 0); dfs2(i, 0, i, 0);
		sort(diam[i].begin(), diam[i].end());
		ll cur = 0; pdiam[i].pb(cur);
		for (int j = diam[i].size()-1; j >= 0; j--) {
			cur += diam[i][j];
			pdiam[i].pb(cur);
		}
	}
	map <ll, ld> memo;
	while (q--) {
		int u, v; scanf("%d %d", &u, &v);
		int cu = cmp[u], cv = cmp[v];
		int su = diam[cu].size(), sv = diam[cv].size();
		if (su > sv) swap (u, v), swap(cu, cv), swap (su, sv);
		if (cu == cv) printf("-1\n");
		else {
			ld ans; ll id = u*1ll*maxn + v;
			if (!memo.count(id)) {
				int mxdiam = max(diam[cu].back(), diam[cv].back());
				ll sum = 0;
				for (int i = 0; i < diam[cu].size(); i++) {
					int curdiam = diam[cu][i];
					int cut = mxdiam - 1 - curdiam;
					int j = lower_bound(diam[cv].begin(), diam[cv].end(), cut) - diam[cv].begin();
					sum += j * 1ll * mxdiam;
					int k = sv - j;
					sum += k * 1ll * (curdiam + 1) + pdiam[cv][k];
				}
				ans = (ld) sum / (ld) (su * 1ll * sv);
				memo[id] = ans;
			} else ans = memo[id];
			printf("%0.8lf\n", ans);
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int maxn = 3e5 + 5;
typedef long long ll;
typedef long double ld;
int n, vis[maxn], dep[maxn], sz[maxn], cmp[maxn];
ll sum[maxn];
vector <int> e[maxn];
void dfs1 (int u, int p) {
	vis[u] = 1;
	dep[u] = 0;
	for (auto v: e[u]) if (v != p) {
		dfs1(v, u);
		dep[u] = max(dep[u], dep[v] + 1);
	}
}
void dfs2 (int u, int p, int c, int mx) {
	cmp[u] = c; sz[c]++;
	int diam = max(dep[u], mx);
	// cout << u << ": " << p << " " << c << " " << diam << endl;
	sum[c] += diam;
	multiset<int> ss;
	for (auto v: e[u]) if (v != p) {
		ss.insert(dep[v]);
	}
	for (auto v: e[u]) if (v != p) {
		ss.erase(ss.find(dep[v]));
		int cmx = mx + 1;
		if (!ss.empty()) cmx = max(cmx, *ss.rbegin() + 1);
		ss.insert(dep[v]);
		dfs2(v, u, c, cmx);
	}
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int m, q; cin >> n >> m >> q;
	while (m--) {
		int u, v; cin >> u >> v;
		e[u].pb(v); e[v].pb(u);
	}
	for (int i = 1; i <= n; i++) if (!vis[i]) {
		dfs1(i, 0); dfs2(i, 0, i, 0);
	}
	cout << fixed << setprecision(10);
	while (q--) {
		int u, v; cin >> u >> v;
		if (cmp[u] == cmp[v]) cout << "-1\n";
		else {
			int cu = cmp[u], cv = cmp[v];
			ld ans = 1;
			ans += (ld) sum[cu] / (ld) sz[cu];
			ans += (ld) sum[cv] / (ld) sz[cv];
			cout << ans << "\n";
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int maxn = 1e5 + 5;
typedef long long ll;
typedef double ld;
bool vis[maxn];
int n, who, val, dep[maxn], dist1[maxn], dist2[maxn], cmp[maxn];
vector <int> e[maxn], rcmp[maxn], diam[maxn];
vector <ll> pdiam[maxn];
void dfs1 (int u, int p, int c, int dist[]) {
	vis[u] = 1; cmp[u] = c; rcmp[c].pb(u);
	dist[u] = p ? dist[p] + 1 : 0;
	if (dist[u] > val) {
		val = dist[u]; who = u;
	}
	for (auto v: e[u]) if (v != p) {
		dfs1(v, u, c, dist);
		dep[u] = max(dep[u], dep[v] + 1);
	}
}
void dfs2 (int u, int p, int dist[]) {
	vis[u] = 1;
	dist[u] = p ? dist[p] + 1 : 0;
	if (dist[u] > val) {
		val = dist[u]; who = u;
	}
	for (auto v: e[u]) if (v != p) {
		dfs2(v, u, dist);
	}
}
int main(){
	int m, q;
	scanf("%d %d %d", &n, &m, &q);
	while (m--) {
		int u, v;
		scanf("%d %d", &u, &v);
		e[u].pb(v); e[v].pb(u);
	}
	for (int i = 1; i <= n; i++) if (!vis[i]) {
		who = i, val = 0;
		dfs1(i, 0, i, dist1);
		val = 0;
		dfs2(who, 0, dist1);
		val = 0;
		dfs2(who, 0, dist2);
		for (auto u: rcmp[i]) diam[i].pb(max(dist1[u], dist2[u]));
		sort(diam[i].begin(), diam[i].end());
		ll cur = 0; pdiam[i].pb(cur);
		for (int j = diam[i].size()-1; j >= 0; j--) {
			cur += diam[i][j];
			pdiam[i].pb(cur);
		}
	}

	unordered_map <ll, ld> memo;
	while (q--) {
		int u, v; scanf("%d %d", &u, &v);
		int cu = cmp[u], cv = cmp[v];
		int su = diam[cu].size(), sv = diam[cv].size();
		if (su > sv) swap (u, v), swap(cu, cv), swap (su, sv);
		if (cu == cv) printf("-1\n");
		else {
			ld ans; ll id = cu*1ll*maxn + cv;
			if (!memo.count(id)) {
				int mxdiam = max(diam[cu].back(), diam[cv].back());
				ll sum = 0;
				for (int i = 0; i < su; i++) {
					int curdiam = diam[cu][i];
					int cut = mxdiam - 1 - curdiam;
					int j = lower_bound(diam[cv].begin(), diam[cv].end(), cut) - diam[cv].begin();
					sum += j * 1ll * mxdiam;
					int k = sv - j;
					sum += k * 1ll * (curdiam + 1) + pdiam[cv][k];
				}
				ans = (ld) sum / (ld) (su * 1ll * sv);
				memo[id] = ans;
			} else ans = memo[id];
			printf("%0.8lf\n", ans);
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int maxn = 3e5 + 5;
typedef long long ll;
typedef long double ld;
int n, vis[maxn], dep[maxn], cmp[maxn];
vector <int> e[maxn], diam[maxn];
vector <ll> pdiam[maxn];
void dfs1 (int u, int p) {
	vis[u] = 1;
	for (auto v: e[u]) if (v != p) {
		dfs1(v, u);
		dep[u] = max(dep[u], dep[v] + 1);
	}
}
void dfs2 (int u, int p, int c, int mx) {
	cmp[u] = c;
	int d = max(dep[u], mx);
	// cout << u << ": " << p << " " << c << " " << diam << endl;
	diam[c].pb(d);
	multiset<int> ss;
	for (auto v: e[u]) if (v != p) {
		ss.insert(dep[v]);
	}
	for (auto v: e[u]) if (v != p) {
		ss.erase(ss.find(dep[v]));
		int cmx = mx + 1;
		if (!ss.empty()) cmx = max(cmx, *ss.rbegin() + 2);
		ss.insert(dep[v]);
		dfs2(v, u, c, cmx);
	}
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int m, q; cin >> n >> m >> q;
	while (m--) {
		int u, v; cin >> u >> v;
		e[u].pb(v); e[v].pb(u);
	}
	for (int i = 1; i <= n; i++) if (!vis[i]) {
		dfs1(i, 0); dfs2(i, 0, i, 0);
		sort(diam[i].begin(), diam[i].end());
		ll cur = 0; pdiam[i].pb(cur);
		for (int j = diam[i].size()-1; j >= 0; j--) {
			cur += diam[i][j];
			pdiam[i].pb(cur);
		}
	}
	cout << fixed << setprecision(10);
	while (q--) {
		int u, v; cin >> u >> v;
		if (cmp[u] == cmp[v]) cout << "-1\n";
		else {
			int cu = cmp[u], cv = cmp[v];
			int su = diam[cu].size(), sv = diam[cv].size();
			if (su > sv) swap (u, v), swap(cu, cv), swap (su, sv);
			int mxdiam = max(diam[cu].back(), diam[cv].back());
			ll sum = 0;
			for (int i = 0; i < diam[cu].size(); i++) {
				int curdiam = diam[cu][i];
				int cut = mxdiam - 1 - curdiam;
				int j = lower_bound(diam[cv].begin(), diam[cv].end(), cut) - diam[cv].begin();
				sum += j * 1ll * mxdiam;
				int k = sv - j;
				sum += k * 1ll * (curdiam + 1) + pdiam[cv][k];
			}
			ld ans = (ld) sum / (ld) (su * 1ll * sv);
			cout << ans << "\n";
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int maxn = 3e5 + 5;
typedef long long ll;
typedef long double ld;
int n, vis[maxn], dep[maxn], sz[maxn], cmp[maxn];
ll sum[maxn];
vector <int> e[maxn];
void dfs1 (int u, int p) {
	vis[u] = 1;
	dep[u] = 0;
	for (auto v: e[u]) if (v != p) {
		dfs1(v, u);
		dep[u] = max(dep[u], dep[v] + 1);
	}
}
void dfs2 (int u, int p, int c, int mx) {
	cmp[u] = c; sz[c]++;
	int diam = max(dep[u], mx);
	// cout << u << ": " << p << " " << c << " " << diam << endl;
	sum[c] += diam;
	multiset<int> ss;
	for (auto v: e[u]) if (v != p) {
		ss.insert(dep[v]);
	}
	for (auto v: e[u]) if (v != p) {
		ss.erase(ss.find(dep[v]));
		int cmx = mx + 1;
		if (!ss.empty()) cmx = max(cmx, *ss.rbegin() + 2);
		ss.insert(dep[v]);
		dfs2(v, u, c, cmx);
	}
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int m, q; cin >> n >> m >> q;
	while (m--) {
		int u, v; cin >> u >> v;
		e[u].pb(v); e[v].pb(u);
	}
	for (int i = 1; i <= n; i++) if (!vis[i]) {
		dfs1(i, 0); dfs2(i, 0, i, 0);
	}
	cout << fixed << setprecision(10);
	while (q--) {
		int u, v; cin >> u >> v;
		if (cmp[u] == cmp[v]) cout << "-1\n";
		else {
			int cu = cmp[u], cv = cmp[v];
			ld ans = 1;
			ans += (ld) sum[cu] / (ld) sz[cu];
			ans += (ld) sum[cv] / (ld) sz[cv];
			cout << ans << "\n";
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int maxn = 3e5 + 5;
typedef long long ll;
typedef double ld;
int n, vis[maxn], dep[maxn], cmp[maxn];
vector <int> e[maxn], diam[maxn];
vector <ll> pdiam[maxn];
void dfs1 (int u, int p) {
	vis[u] = 1;
	for (auto v: e[u]) if (v != p) {
		dfs1(v, u);
		dep[u] = max(dep[u], dep[v] + 1);
	}
}
void dfs2 (int u, int p, int c, int mx) {
	cmp[u] = c;
	int d = max(dep[u], mx);
	// cout << u << ": " << p << " " << c << " " << diam << endl;
	diam[c].pb(d);
	multiset<int> ss;
	for (auto v: e[u]) if (v != p) {
		ss.insert(dep[v]);
	}
	for (auto v: e[u]) if (v != p) {
		ss.erase(ss.find(dep[v]));
		int cmx = mx + 1;
		if (!ss.empty()) cmx = max(cmx, *ss.rbegin() + 2);
		ss.insert(dep[v]);
		dfs2(v, u, c, cmx);
	}
}
int main(){
	int m, q; scanf("%d %d %d", &n, &m, &q);
	while (m--) {
		int u, v; scanf("%d %d", &u, &v);
		e[u].pb(v); e[v].pb(u);
	}
	for (int i = 1; i <= n; i++) if (!vis[i]) {
		dfs1(i, 0); dfs2(i, 0, i, 0);
		sort(diam[i].begin(), diam[i].end());
		ll cur = 0; pdiam[i].pb(cur);
		for (int j = diam[i].size()-1; j >= 0; j--) {
			cur += diam[i][j];
			pdiam[i].pb(cur);
		}
	}
	map <ll, ld> memo;
	while (q--) {
		int u, v; scanf("%d %d", &u, &v);
		if (cmp[u] == cmp[v]) printf("-1\n");
		else {
			ld ans; ll id = u*1ll*maxn + v;
			if (!memo.count(id)) {
				int cu = cmp[u], cv = cmp[v];
				int su = diam[cu].size(), sv = diam[cv].size();
				if (su > sv) swap (u, v), swap(cu, cv), swap (su, sv);
				int mxdiam = max(diam[cu].back(), diam[cv].back());
				ll sum = 0;
				for (int i = 0; i < diam[cu].size(); i++) {
					int curdiam = diam[cu][i];
					int cut = mxdiam - 1 - curdiam;
					int j = lower_bound(diam[cv].begin(), diam[cv].end(), cut) - diam[cv].begin();
					sum += j * 1ll * mxdiam;
					int k = sv - j;
					sum += k * 1ll * (curdiam + 1) + pdiam[cv][k];
				}
				ans = (ld) sum / (ld) (su * 1ll * sv);
				memo[id] = ans;
			} else ans = memo[id];
			printf("%0.8lf\n", ans);
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
const int maxn = 3e5 + 5;
typedef long long ll;
typedef double ld;
int n, vis[maxn], dep[maxn], cmp[maxn];
vector <int> e[maxn], diam[maxn];
vector <ll> pdiam[maxn];
void dfs1 (int u, int p) {
	vis[u] = 1;
	for (auto v: e[u]) if (v != p) {
		dfs1(v, u);
		dep[u] = max(dep[u], dep[v] + 1);
	}
}
void dfs2 (int u, int p, int c, int mx) {
	cmp[u] = c;
	int d = max(dep[u], mx);
	// cout << u << ": " << p << " " << c << " " << diam << endl;
	diam[c].pb(d);
	multiset<int> ss;
	for (auto v: e[u]) if (v != p) {
		ss.insert(dep[v]);
	}
	for (auto v: e[u]) if (v != p) {
		ss.erase(ss.find(dep[v]));
		int cmx = mx + 1;
		if (!ss.empty()) cmx = max(cmx, *ss.rbegin() + 2);
		ss.insert(dep[v]);
		dfs2(v, u, c, cmx);
	}
}
int main(){
	int m, q; scanf("%d %d %d", &n, &m, &q);
	while (m--) {
		int u, v; scanf("%d %d", &u, &v);
		e[u].pb(v); e[v].pb(u);
	}
	for (int i = 1; i <= n; i++) if (!vis[i]) {
		dfs1(i, 0); dfs2(i, 0, i, 0);
		sort(diam[i].begin(), diam[i].end());
		ll cur = 0; pdiam[i].pb(cur);
		for (int j = diam[i].size()-1; j >= 0; j--) {
			cur += diam[i][j];
			pdiam[i].pb(cur);
		}
	}
	while (q--) {
		int u, v; scanf("%d %d", &u, &v);
		if (cmp[u] == cmp[v]) printf("-1\n");
		else {
			int cu = cmp[u], cv = cmp[v];
			int su = diam[cu].size(), sv = diam[cv].size();
			if (su > sv) swap (u, v), swap(cu, cv), swap (su, sv);
			int mxdiam = max(diam[cu].back(), diam[cv].back());
			ll sum = 0;
			for (int i = 0; i < diam[cu].size(); i++) {
				int curdiam = diam[cu][i];
				int cut = mxdiam - 1 - curdiam;
				int j = lower_bound(diam[cv].begin(), diam[cv].end(), cut) - diam[cv].begin();
				sum += j * 1ll * mxdiam;
				int k = sv - j;
				sum += k * 1ll * (curdiam + 1) + pdiam[cv][k];
			}
			ld ans = (ld) sum / (ld) (su * 1ll * sv);
			printf("%0.8lf\n", ans);
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <queue>
#include <cstring>
#include <set>
#include <list>
#include <map>
#include <random>
#include <unordered_map>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef std::vector<string> vs;
typedef std::vector<double> vd;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<int> > vvi;
typedef vector<vvi> vvvi;
typedef vector<vll> vvll;
typedef std::vector<std::pair<int, int> > vpi;
typedef vector<vpi> vvpi;
typedef std::pair<int, int> pi;
typedef std::pair<ll, ll> pll;
typedef std::vector<pll> vpll;
typedef std::vector<vpll> vvpll;

const long long mod = 1000000007;

#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define forn(i, a, b) for(int i = a; i < b; i++)

#define pb push_back
#define mp make_pair

const int MAXN = 100100;
vector<int> lst[MAXN];
int parent[MAXN];

void make_set (int v) {
    lst[v] = vector<int> (1, v);
    parent[v] = v;
}

int find_set (int v) {
    return parent[v];
}

void union_sets (int a, int b) {
    a = find_set (a);
    b = find_set (b);
    if (a != b) {
        if (lst[a].size() < lst[b].size())
            swap (a, b);
        while (!lst[b].empty()) {
            int v = lst[b].back();
            lst[b].pop_back();
            parent[v] = a;
            lst[a].push_back (v);
        }

    }
}

vvi nb;
vi diam;
set<pi> done;
map<pi, double> ans;
vvi dist;
vvpll gdist;
int n,m,q;
int A = 300;

bool big(int v) {
    return lst[v].size() > A;
}

struct b2 {
    int a = 0, b = 0;
    void upd(int c) {
        if(c >= a) {
            b = a;
            a = c;
        }
        else if(c > b) {
            b = c;
        }
    }
    int res() {
        return a + b;
    }
};
vector<b2> w;

void dfsd(int v, int p) {
    for(auto u : nb[v]) {
        if (u == p) continue;
        dfsd(u,v);
//        bd[v] = max(bd[v], 1+bd[u]);
        w[v].upd(1+w[u].a);
    }
}

void dfsu(int v, int p) {
    for(auto u : nb[v]) {
        if (u == p) continue;
        int wd = w[u].a + 1;
        if (wd == w[v].a) w[u].upd(w[v].b+1);
        else w[u].upd(w[v].a+1);
        dfsu(u,v);
    }
    diam[find_set(v)] = max(diam[find_set(v)], w[v].res());
    dist[find_set(v)].pb(w[v].a);
}

void get_dist(int v) {
    dfsd(v, -1);
    dfsu(v, -1);
}

void pre() {
    dist.resize(n);
    gdist.resize(n);
    diam.resize(n);
    w.resize(n);
    forn(i,0,n) if(lst[i].size() > 0) get_dist(i);
    forn(i,0,n) sort(all(dist[i]));
    forn(i,0,n) {
        int last = -1;
        for(auto x : dist[i]) {
            if(x==last) gdist[i].back().second++;
            else {
                last = x;
                gdist[i].pb(mp(last,1));
            }
        }
    }
//    forn(i,0,n) if(big(i)) {
//        get_dist(i);
//    }
}

void build(int u, int v) {
    ll was = max(diam[u], diam[v]);
    int pt = 0;
    if(gdist[u].size() > gdist[v].size()) swap(u,v);
    ll cntless = 0;
    ll cntmore = dist[v].size();
    ll tot = 0;
    ll tres = 0;
    for(auto x : gdist[v]) tot += (x.first+1) * x.second;
    for(int i = gdist[u].size() - 1; i >= 0; i--) {
        while(pt < gdist[v].size() && gdist[v][pt].first + 1 + gdist[u][i].first <= was) {
            pll x = gdist[v][pt];
            tot -= (x.first+1) * x.second;
            pt++;
            cntless += x.second;
            cntmore -= x.second;
        }
        tres += (gdist[u][i].first * cntmore + tot) * gdist[u][i].second + was * cntless;
    }

    double res = (double)tres / ((ll) dist[u].size() * (ll) dist[v].size());
    done.insert(mp(u,v));
    done.insert(mp(v,u));
    ans[mp(u,v)] = res;
    ans[mp(v,u)] = res;
}

double get(int u, int v) {
    u = find_set(u);
    v = find_set(v);
    if (u > v) swap(u,v);
    if (u == v) return -1;
    if (done.find(mp(u,v)) != done.end()) return ans[mp(u,v)];
    build(u, v);
    return ans[mp(u,v)];
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
#endif

    scanf("%d %d %d", &n, &m, &q);
    nb.resize(n);
    forn(i,0,n) make_set(i);
    forn(i,0,m) {
        int u,v;
        scanf("%d %d", &u, &v);
        u--; v--;
        nb[u].pb(v);
        nb[v].pb(u);
        union_sets(u, v);
    }
    pre();
    forn(i,0,q) {
        int u,v;
        scanf("%d %d", &u, &v);
        u--; v--;
        printf("%.10lf\n", get(u,v));
    }
}