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

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

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

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

d = A("d")
g = B("g")
c = C("c")
f = D("f")
m = D("m")
e = A("e")
l = A("l")
k = A("k")

d.o = m
d.u = f
d.y = g
g.z = e
c.w = g
f.r = m
f.v = c
m.r = f
m.v = c
e.o = m
e.u = f
e.y = g
l.o = m
l.u = f
l.y = g
k.o = f
k.u = m
k.y = g
assert c.w.z.u.r.v.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: D = None
        self.y: B = None
        self.txt = txt

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

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

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

d = A("d")
g = B("g")
c = C("c")
f = D("f")
m = D("m")
e = A("e")
l = A("l")
k = A("k")

d.o = m
d.u = f
d.y = g
g.z = e
c.w = g
f.r = m
f.v = c
m.r = f
m.v = c
e.o = m
e.u = f
e.y = g
l.o = m
l.u = f
l.y = g
k.o = f
k.u = m
k.y = g
assert c.w.z.u.r.v.w.z.txt == "e"