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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: A = None
        self.x: D = None
        self.t: B = None
        self.u: B = None
        self.txt = txt

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

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

c = A("c")
j = B("j")
h = C("h")
k = D("k")
b = E("b")

c.u = k
c.x = j
c.t = h
c.q = b
j.p = k
h.q = b
h.z = c
h.x = k
h.t = j
h.u = j
k.z = c
b.o = k
b.p = c
assert b.p.q.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: B = None
        self.t: C = None
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: A = None
        self.x: D = None
        self.t: B = None
        self.u: B = None
        self.txt = txt

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

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

c = A("c")
j = B("j")
h = C("h")
k = D("k")
b = E("b")

c.u = k
c.x = j
c.t = h
c.q = b
j.p = k
h.q = b
h.z = c
h.x = k
h.t = j
h.u = j
k.z = c
b.o = k
b.p = c
assert b.p.q.o.z.txt == "c"