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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: C = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: C = None
        self.txt = txt

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

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

e.y = l
e.p = m
e.w = c
l.v = f
l.o = m
l.r = m
l.x = m
f.s = e
f.u = a
d.z = m
a.s = e
a.u = f
m.v = a
m.o = l
m.r = l
m.x = l
c.z = l
k.z = l
assert f.u.s.w.txt == "c"