public static int findCommonManager(Employee a, Employee b) {
        List<Integer> lineA = new ArrayList<Integer>();
        while(a != null){
            lineA.add(a.id);
            a = a.manager;
        }

        List<Integer> lineB = new ArrayList<Integer>();
        while(b != null){
            lineB.add(b.id);
            b = b.manager;
        }
        int id = -1;
        for(int i = 1;;i++){
            if( i > lineA.size() || i > lineB.size())
                break;
            if(lineA.get(lineA.size()-i) == lineB.get(lineB.size()-i)){
                id = lineA.get(lineA.size()-i);
                continue;
            }else{
                break;
            }
        }
        return id;

    }