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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: B = None
        self.u: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: A = None
        self.z: B = None
        self.y: B = None
        self.w: B = None
        self.txt = txt

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

j.z = n
c.z = g
c.u = g
c.w = d
l.p = n
l.q = j
l.u = g
n.p = c
n.t = g
g.v = l
g.q = j
g.z = d
g.y = c
g.w = c
d.z = g
d.u = g
d.w = c
assert c.w.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.w: B = None
        self.u: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: A = None
        self.z: B = None
        self.y: B = None
        self.w: B = None
        self.txt = txt

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

j.z = n
c.z = g
c.u = g
c.w = d
l.p = n
l.q = j
l.u = g
n.p = c
n.t = g
g.v = l
g.q = j
g.z = d
g.y = c
g.w = c
d.z = g
d.u = g
d.w = c
assert c.w.u.y.txt == "c"