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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.z: A = None
        self.y: E = None
        self.o: C = None
        self.t: E = None
        self.txt = txt

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

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

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

d = A("d")
n = B("n")
c = C("c")
g = D("g")
j = E("j")

d.q = j
d.u = c
d.p = c
d.y = c
n.s = j
n.y = j
n.t = j
n.z = d
n.o = c
c.p = g
c.o = g
c.x = d
c.t = n
c.r = j
g.z = j
g.y = j
j.u = d
assert c.o.y.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: C = None
        self.p: C = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.z: A = None
        self.y: E = None
        self.o: C = None
        self.t: E = None
        self.txt = txt

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

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

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

d = A("d")
n = B("n")
c = C("c")
g = D("g")
j = E("j")

d.q = j
d.u = c
d.p = c
d.y = c
n.s = j
n.y = j
n.t = j
n.z = d
n.o = c
c.p = g
c.o = g
c.x = d
c.t = n
c.r = j
g.z = j
g.y = j
j.u = d
assert c.o.y.u.q.txt == "j"