Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Declare 1 Attribute and select a total of 2 monsters with that Attribute from the Graveyards. Remove those monsters from play.
--異次元への隙間
--Crevice Into the Different Dimension
local s,id=GetID()
function s.initial_effect(c)
	--Activate
	local e1=Effect.CreateEffect(c)
	e1:SetCategory(CATEGORY_REMOVE)
	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
end
function s.filter(c,e)
	return c:IsMonster() and c:IsCanBeEffectTarget(e) and c:IsAbleToRemove() and aux.SpElimFilter(c,true)
end
function s.filter1(c,g)
	return g:IsExists(Card.IsAttribute,1,c,c:GetAttribute())
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
	if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and s.filter(chkc,e) end
	if chk==0 then
		local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,nil,e)
		return g:IsExists(s.filter1,1,nil,g)
	end
	local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,nil,e)
	local rg=g:Filter(s.filter1,nil,g)
	local tc=rg:GetFirst()
	local att=0
	for tc in aux.Next(rg) do
		att=(att|tc:GetAttribute())
	end
	local ac=Duel.AnnounceAttribute(tp,1,att)
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
	local sg=rg:FilterSelect(tp,Card.IsAttribute,2,2,nil,ac)
	Duel.SetTargetCard(sg)
	Duel.SetOperationInfo(0,CATEGORY_REMOVE,sg,2,0,0)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
	local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
	local sg=g:Filter(Card.IsRelateToEffect,nil,e)
	Duel.Remove(sg,POS_FACEUP,REASON_EFFECT)
end