from functools import reduce

ip = [
	['192.168.1.1','168.95.98.254','168.95.83.70','220.128.2.226','220.128.1.101','168.95.25.13'],
	['192.168.1.1','168.95.98.254','168.95.82.6','220.128.1.6','220.128.1.101','36.226.251.254']
]

nodeDict = {
	'192.168.1.1': '0',
	'168.95.98.254': '1',
	'168.95.83.70': '2',
	'220.128.2.226': '3',
	'220.128.1.101': '4',
	'168.95.25.13': '5',
	'168.95.82.6': '6',
	'220.128.1.6': '7',
	'36.226.251.254': '8'
}

def genPath(ipList):
	_ = list(map(lambda x: nodeDict.get(x), ipList))
	return list("".join(z) for z in zip(_[:-1], _[1:]))
	

paths = [genPath(path) for path in ip]
h1 = reduce(lambda x, y: set(x)|set(y), paths)