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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: A = None
        self.txt = txt

n = A("n")
f = B("f")
c = C("c")
h = D("h")
b = B("b")

n.s = h
f.o = h
f.y = n
c.v = n
c.z = n
c.t = n
c.o = h
h.u = c
h.t = n
b.o = h
b.y = n
assert c.o.t.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: A = None
        self.txt = txt

n = A("n")
f = B("f")
c = C("c")
h = D("h")
b = B("b")

n.s = h
f.o = h
f.y = n
c.v = n
c.z = n
c.t = n
c.o = h
h.u = c
h.t = n
b.o = h
b.y = n
assert c.o.t.s.u.txt == "c"