Message getMessage(double x, double y) {
        Message result = null;
        for (Edge edge : edges)
            for (Message message : edge.queue.getMessages()) {
                if (message.isOnPoint(x, y)
                        && (result == null || message.position < result.position))
                    result = message;
            }
        return result;
    }