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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: A = None
        self.s: C = None
        self.w: E = None
        self.txt = txt

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

k = A("k")
d = B("d")
j = C("j")
c = D("c")
e = E("e")
a = A("a")

k.q = j
k.p = c
k.y = c
k.w = e
d.u = a
j.q = d
j.y = c
c.v = j
c.s = j
c.u = a
c.w = e
e.w = d
e.q = c
e.u = j
e.r = j
a.q = j
a.p = c
a.y = c
a.w = e
assert j.y.v.y.w.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: D = None
        self.w: E = None
        self.y: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: A = None
        self.s: C = None
        self.w: E = None
        self.txt = txt

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

k = A("k")
d = B("d")
j = C("j")
c = D("c")
e = E("e")
a = A("a")

k.q = j
k.p = c
k.y = c
k.w = e
d.u = a
j.q = d
j.y = c
c.v = j
c.s = j
c.u = a
c.w = e
e.w = d
e.q = c
e.u = j
e.r = j
a.q = j
a.p = c
a.y = c
a.w = e
assert j.y.v.y.w.r.y.txt == "c"