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

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

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

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

f = A("f")
a = B("a")
i = C("i")
g = D("g")
e = D("e")

f.x = i
f.u = i
f.y = a
f.t = a
a.u = f
a.z = f
a.o = e
i.s = f
i.q = f
i.r = f
i.p = g
g.s = f
e.s = f
assert i.r.u.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: C = None
        self.y: B = None
        self.t: B = None
        self.txt = txt

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

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

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

f = A("f")
a = B("a")
i = C("i")
g = D("g")
e = D("e")

f.x = i
f.u = i
f.y = a
f.t = a
a.u = f
a.z = f
a.o = e
i.s = f
i.q = f
i.r = f
i.p = g
g.s = f
e.s = f
assert i.r.u.p.s.txt == "f"