registers = {
	["filostack"] = {},
	["fifostack"] = {},
	["lifostack"] = {},
	["lilostack"] = {},
	["filo"] = {
		["push"] = function(var)
			if not var then return false end
			registers.filostack[#registers.filostack + 1] = var
			return true
		end,
		["pop"] = function()
			local var = registers.filostack[#registers.filostack]
			if not var then return false end
			registers.filostack[#registers.filostack] = nil
			return var
		end,
	},
	["fifo"] = {
		["push"] = function(var)
			if not var then return false end
			registers.fifostack[#registers.fifostack + 1] = var
			return true
		end,
		["pop"] = function()
			local var = registers.fifostack[1]
			if not var then return false end
			registers.fifostack[1] = nil
			for i = 1, #registers.fifostack do
				registers.fifostack[i] = registers.fifostack[i + 1]
				registers.fifostack[i + 1] = nil
			end
			return var
		end,
	},
	["lifo"] = {
		["push"] = function(var)
			if not var then return false end
			for i = 1, #registers.lifostack do
				registers.lifostack[i + 1] = registers.lifostack[i]
			end
			registers.lifostack[1] = var
			return true
		end,
		["pop"] = function()
			local var = #registers.lifostack
			if not var then return false end
			registers.lifostack[#registers.lifostack] = nil
			return var
		end,
	},
}

print("lifo")
print("")
for i = 1, 10 do
	print("push")
	print(registers.lifo.push(i))
end
print("")
for k, v in ipairs(registers.lifostack) do
	print(v)
end
print("")
for i = 1, #registers.lifostack do
	print("pop")
	print(registers.lifo.pop())
end
print("")
print("lilo")
print("")
for i = 1, 4 do
	print("push")
	print(registers.lilo.push(i))
end
print("")
for k, v in ipairs(registers.lilostack) do
	print(v)
end
print("")
for i = 1, #registers.lilostack do
	print("pop")
	print(registers.lilo.pop())
end
