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

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

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

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

m = A("m")
l = B("l")
j = C("j")
i = D("i")
g = D("g")
k = D("k")
h = A("h")
e = C("e")
f = C("f")
c = D("c")

m.z = h
m.v = e
m.p = c
l.w = m
l.o = f
j.r = l
j.x = i
i.p = f
i.o = c
g.p = j
g.o = c
k.p = f
k.o = c
h.z = m
h.v = j
h.p = g
e.r = l
e.x = i
f.r = l
f.x = c
c.p = f
c.o = g
assert f.x.p.x.p.x.p.r.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: C = None
        self.p: D = None
        self.txt = txt

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

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

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

m = A("m")
l = B("l")
j = C("j")
i = D("i")
g = D("g")
k = D("k")
h = A("h")
e = C("e")
f = C("f")
c = D("c")

m.z = h
m.v = e
m.p = c
l.w = m
l.o = f
j.r = l
j.x = i
i.p = f
i.o = c
g.p = j
g.o = c
k.p = f
k.o = c
h.z = m
h.v = j
h.p = g
e.r = l
e.x = i
f.r = l
f.x = c
c.p = f
c.o = g
assert f.x.p.x.p.x.p.r.w.v.txt == "e"