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

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

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

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

e = A("e")
j = B("j")
b = C("b")
g = D("g")
i = A("i")

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

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

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

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

e = A("e")
j = B("j")
b = C("b")
g = D("g")
i = A("i")

e.s = g
e.q = g
e.o = j
j.z = b
j.x = g
j.s = e
b.u = g
b.p = g
g.t = e
i.s = g
i.q = g
i.o = j
assert j.x.t.o.z.txt == "b"