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

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

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

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

c = A("c")
e = B("e")
b = C("b")
h = D("h")
i = B("i")

c.s = e
e.o = i
e.u = i
e.x = i
e.t = b
b.z = h
b.x = h
b.o = c
b.q = c
h.s = b
i.o = e
i.u = e
i.x = e
i.t = b
assert b.x.s.o.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

c = A("c")
e = B("e")
b = C("b")
h = D("h")
i = B("i")

c.s = e
e.o = i
e.u = i
e.x = i
e.t = b
b.z = h
b.x = h
b.o = c
b.q = c
h.s = b
i.o = e
i.u = e
i.x = e
i.t = b
assert b.x.s.o.s.t.txt == "b"