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

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

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

l = A("l")
j = B("j")
f = C("f")
n = A("n")
h = A("h")
b = A("b")
e = C("e")

l.o = b
l.p = j
l.z = j
j.w = h
f.p = b
n.o = h
n.p = j
n.z = j
h.o = n
h.p = j
h.z = j
b.o = l
b.p = j
b.z = j
e.p = b
assert l.p.w.p.w.z.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: B = None
        self.z: B = None
        self.txt = txt

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

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

l = A("l")
j = B("j")
f = C("f")
n = A("n")
h = A("h")
b = A("b")
e = C("e")

l.o = b
l.p = j
l.z = j
j.w = h
f.p = b
n.o = h
n.p = j
n.z = j
h.o = n
h.p = j
h.z = j
b.o = l
b.p = j
b.z = j
e.p = b
assert l.p.w.p.w.z.w.p.txt == "j"