public static Input exileFromTopType(final SpellAbility spell, final String type, final Cost_Payment payment) {
        Input target = new Input() {
            private static final long serialVersionUID = -4764871768555887091L;

            @Override
            public void showMessage() {
                CardList typeList;
                int nNeeded = payment.getCost().getExileFromTopAmount();
                PlayerZone lib = AllZone.getZone(Constant.Zone.Library, spell.getSourceCard().getController());
                typeList = AllZoneUtil.getPlayerCardsInLibrary(spell.getSourceCard().getController());
                typeList = typeList.getValidCards(type.split(";"), spell.getActivatingPlayer(), spell.getSourceCard());

                for (int i = 0; i < nNeeded; i++) {
                    if (typeList.size() == 0)
                        cancel();

                    if (lib.size() > 0) {
                        Card c = typeList.get(0);
                        typeList.remove(c);
                        payment.getAbility().addCostToHashList(c, "Exiled");
                        AllZone.getGameAction().exile(c);
                        if (i == nNeeded - 1) done();
                    }
                }
            }

            @Override
            public void selectButtonCancel() {
                cancel();
            }

            public void done() {
                payment.setPayExileFromTop(true);
                stop();
                payment.payCost();
            }

            public void cancel() {
                payment.setCancel(true);
                stop();
                payment.payCost();
            }
        };
        return target;
    }//exileFromTopType()