void doTheNecessary(Node *n, mset &open, mset &closed)
{
	if(!(findInOpen(n,open) || findInClosed(n,open,closed)))
	{
		open.insert(n);
	}
}
int findInClosed(Node *n, mset &open, mset &closed)
{
	for(mset::iterator p=closed.begin(); p!=closed.end() ; p++)
	{
		if((*p)->x==n->x && (*p)->y==n->y )
		{
			if((*p)->fm > n->fm)
			{
				closed.erase(p);
				open.insert(n);
			}
			return 1;
		}
		
	}
	return 0;
}