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

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.u: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

d.s = n
d.v = n
d.p = n
d.w = l
h.v = m
k.o = l
k.u = g
m.y = l
m.z = d
l.o = h
c.v = m
j.s = n
j.v = n
j.w = n
j.p = n
n.o = h
g.o = n
g.u = k
assert m.y.o.v.y.o.v.z.w.txt == "l"