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

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

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

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

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

c = A("c")
f = B("f")
g = C("g")
i = D("i")
k = E("k")

c.q = i
f.s = g
f.y = i
g.r = c
g.x = k
g.t = f
g.p = i
g.y = i
i.o = c
i.u = k
i.t = f
k.t = f
k.x = f
k.v = c
k.z = c
assert g.r.q.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

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

c = A("c")
f = B("f")
g = C("g")
i = D("i")
k = E("k")

c.q = i
f.s = g
f.y = i
g.r = c
g.x = k
g.t = f
g.p = i
g.y = i
i.o = c
i.u = k
i.t = f
k.t = f
k.x = f
k.v = c
k.z = c
assert g.r.q.u.x.txt == "f"