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

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

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

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

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

m = A("m")
c = B("c")
i = C("i")
g = D("g")
j = E("j")
k = B("k")
d = A("d")

m.y = c
m.w = g
m.p = i
c.w = g
c.u = k
c.o = j
c.p = m
i.x = m
i.y = j
i.p = g
g.q = j
g.y = j
j.x = g
j.s = g
j.z = g
j.p = m
j.r = k
k.w = g
k.u = c
k.o = j
k.p = m
d.y = c
d.w = g
d.p = i
assert c.w.q.z.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: D = None
        self.p: C = None
        self.txt = txt

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

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

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

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

m = A("m")
c = B("c")
i = C("i")
g = D("g")
j = E("j")
k = B("k")
d = A("d")

m.y = c
m.w = g
m.p = i
c.w = g
c.u = k
c.o = j
c.p = m
i.x = m
i.y = j
i.p = g
g.q = j
g.y = j
j.x = g
j.s = g
j.z = g
j.p = m
j.r = k
k.w = g
k.u = c
k.o = j
k.p = m
d.y = c
d.w = g
d.p = i
assert c.w.q.z.q.r.txt == "k"