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

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

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

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

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

d = A("d")
c = B("c")
b = C("b")
l = D("l")
j = E("j")
n = C("n")
a = C("a")
e = D("e")

d.x = c
d.q = j
d.y = l
c.q = l
b.p = d
b.z = n
b.q = a
b.u = a
b.r = c
l.y = c
l.x = e
l.t = j
j.s = d
n.p = d
n.z = a
n.q = b
n.u = b
n.r = c
a.p = d
a.z = b
a.q = b
a.r = c
a.u = n
e.y = c
e.x = l
e.t = j
assert c.q.y.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

d = A("d")
c = B("c")
b = C("b")
l = D("l")
j = E("j")
n = C("n")
a = C("a")
e = D("e")

d.x = c
d.q = j
d.y = l
c.q = l
b.p = d
b.z = n
b.q = a
b.u = a
b.r = c
l.y = c
l.x = e
l.t = j
j.s = d
n.p = d
n.z = a
n.q = b
n.u = b
n.r = c
a.p = d
a.z = b
a.q = b
a.r = c
a.u = n
e.y = c
e.x = l
e.t = j
assert c.q.y.q.y.txt == "c"