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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: C = None
        self.txt = txt

n = A("n")
b = B("b")
c = C("c")
f = D("f")
j = A("j")
m = A("m")
l = A("l")

n.t = b
n.z = b
b.r = f
b.p = f
c.o = b
f.z = c
f.s = c
j.t = b
j.z = b
m.t = b
m.z = b
l.t = b
l.z = b
assert b.p.s.o.p.z.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: C = None
        self.txt = txt

n = A("n")
b = B("b")
c = C("c")
f = D("f")
j = A("j")
m = A("m")
l = A("l")

n.t = b
n.z = b
b.r = f
b.p = f
c.o = b
f.z = c
f.s = c
j.t = b
j.z = b
m.t = b
m.z = b
l.t = b
l.z = b
assert b.p.s.o.p.z.o.p.txt == "f"