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

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

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

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

m = A("m")
f = B("f")
g = C("g")
l = D("l")
b = C("b")
e = A("e")
j = B("j")

m.v = e
m.y = e
m.o = l
m.z = j
f.w = b
f.y = j
f.u = l
g.t = e
g.s = l
g.w = l
l.s = m
l.x = e
b.t = m
b.s = l
b.w = l
e.v = m
e.y = m
e.o = l
e.z = f
j.w = b
j.y = f
j.u = l
assert m.z.y.w.s.x.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: A = None
        self.o: D = None
        self.z: B = None
        self.txt = txt

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

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

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

m = A("m")
f = B("f")
g = C("g")
l = D("l")
b = C("b")
e = A("e")
j = B("j")

m.v = e
m.y = e
m.o = l
m.z = j
f.w = b
f.y = j
f.u = l
g.t = e
g.s = l
g.w = l
l.s = m
l.x = e
b.t = m
b.s = l
b.w = l
e.v = m
e.y = m
e.o = l
e.z = f
j.w = b
j.y = f
j.u = l
assert m.z.y.w.s.x.z.w.txt == "b"