pair<std::vector<Permutation<element_type, rank_type>* >, std::map<string, int> >  load_format_trec(string qresult){
		std::string line;
		std::map<string, int> map_queries;
		std::vector<Permutation<element_type, rank_type>* > rankings;
		
		ifstream infile;
    	infile.open(qresult.c_str());

    	while(infile.good() && std::getline( infile, line )){
    		std::vector<std::string> strs = split(line, ' ');

    		element_type elem = atoi(&(strs[2]).c_str()[0]);
    		rank_type pos = atoi(&(strs[3]).c_str()[0]);

    		std::map<string, int>::iterator it = map_queries.find(strs[0]);
            if(it != map_queries.end()){
                rankings[it->second]->addElement(elem, pos);
            }else{
            	Permutation<element_type, rank_type>* p = new perm_imp_type();
    			p->addElement(elem, pos);
    			rankings.push_back(p);
    			map_queries[strs[0]] = map_queries.size() - 1;
            }
    	}

    	infile.close();
    	return make_pair(rankings, map_queries);
	}
	void union_perm(Permutation<element_type, rank_type> &sigma, Permutation<element_type, rank_type> &tau){
		
		for (typename Permutation<element_type, rank_type>::iterator it = tau.begin(); it != tau.end(); ++it)
		{
			sigma.addElement(it->first, sigma(it->first));
		}
	}
	void union_all(Permutation<element_type, rank_type> &sigma, vector<Permutation<element_type, rank_type> *>&perms){
		//Permutation<element_type, rank_type> * perm = perms[0];
		for (int i = 0; i < perms.size(); ++i)
		{	
			for (typename Permutation<element_type, rank_type>::iterator it = perms[i]->begin(); it != perms[i]->end(); ++it)
			{
				sigma.addElement(it->first, sigma(it->first));
			}
		}
	}