class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: A = None
        self.txt = txt

e = A("e")
d = B("d")
g = A("g")
m = A("m")
f = A("f")
n = B("n")
h = B("h")
i = A("i")
c = B("c")

e.z = g
e.t = g
d.s = g
d.x = f
g.z = i
g.t = m
m.z = g
m.t = g
f.z = e
f.t = i
n.s = g
n.x = m
h.s = f
h.x = i
i.z = m
i.t = e
c.s = e
c.x = m
assert n.s.t.z.z.z.t.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.x: A = None
        self.txt = txt

e = A("e")
d = B("d")
g = A("g")
m = A("m")
f = A("f")
n = B("n")
h = B("h")
i = A("i")
c = B("c")

e.z = g
e.t = g
d.s = g
d.x = f
g.z = i
g.t = m
m.z = g
m.t = g
f.z = e
f.t = i
n.s = g
n.x = m
h.s = f
h.x = i
i.z = m
i.t = e
c.s = e
c.x = m
assert n.s.t.z.z.z.t.z.z.txt == "m"