class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: A = None
        self.z: A = None
        self.txt = txt

i = A("i")
a = B("a")
n = C("n")
m = C("m")
d = C("d")
j = A("j")
e = B("e")
b = A("b")

i.w = e
i.p = d
a.y = e
n.o = b
n.p = i
n.z = j
m.o = b
m.p = i
m.z = j
d.o = b
d.p = i
d.z = i
j.w = a
j.p = m
e.y = a
b.w = e
b.p = n
assert e.y.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: A = None
        self.z: A = None
        self.txt = txt

i = A("i")
a = B("a")
n = C("n")
m = C("m")
d = C("d")
j = A("j")
e = B("e")
b = A("b")

i.w = e
i.p = d
a.y = e
n.o = b
n.p = i
n.z = j
m.o = b
m.p = i
m.z = j
d.o = b
d.p = i
d.z = i
j.w = a
j.p = m
e.y = a
b.w = e
b.p = n
assert e.y.y.y.y.y.y.y.txt == "a"