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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

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

f = A("f")
j = B("j")
l = C("l")
c = D("c")
e = A("e")
d = C("d")

f.s = l
j.z = c
j.x = c
l.u = d
l.r = j
l.p = c
c.s = l
c.o = j
c.t = j
e.s = d
d.u = l
d.r = j
d.p = c
assert c.t.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

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

f = A("f")
j = B("j")
l = C("l")
c = D("c")
e = A("e")
d = C("d")

f.s = l
j.z = c
j.x = c
l.u = d
l.r = j
l.p = c
c.s = l
c.o = j
c.t = j
e.s = d
d.u = l
d.r = j
d.p = c
assert c.t.z.s.txt == "l"