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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

m.o = k
m.s = l
m.z = n
d.r = m
d.p = n
d.q = g
d.z = g
g.v = d
l.y = d
l.w = d
l.o = g
n.v = m
n.w = l
n.p = g
k.y = c
k.w = c
k.o = g
c.r = m
c.p = n
c.q = g
c.z = g
assert k.o.v.r.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: D = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

m.o = k
m.s = l
m.z = n
d.r = m
d.p = n
d.q = g
d.z = g
g.v = d
l.y = d
l.w = d
l.o = g
n.v = m
n.w = l
n.p = g
k.y = c
k.w = c
k.o = g
c.r = m
c.p = n
c.q = g
c.z = g
assert k.o.v.r.s.y.txt == "d"