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

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

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

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

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

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

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

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

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

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

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

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

c.r = b
c.u = b
c.p = a
c.q = a
k.o = b
k.u = b
k.r = a
k.x = c
b.t = h
h.r = b
h.u = b
h.x = b
h.q = k
a.x = k
a.t = k
assert h.q.x.q.txt == "a"