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

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

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

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

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

m.o = f
m.y = a
m.z = k
m.v = k
d.p = k
k.y = h
h.u = f
h.w = k
h.v = k
h.t = l
l.u = f
l.w = k
l.v = k
l.t = c
f.o = a
f.y = m
f.z = k
f.v = k
i.p = k
a.o = m
a.y = f
a.z = k
a.v = k
c.u = f
c.w = k
c.v = k
c.t = h
j.p = k
assert f.z.y.u.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: A = None
        self.z: C = None
        self.v: C = None
        self.txt = txt

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

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

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

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

m.o = f
m.y = a
m.z = k
m.v = k
d.p = k
k.y = h
h.u = f
h.w = k
h.v = k
h.t = l
l.u = f
l.w = k
l.v = k
l.t = c
f.o = a
f.y = m
f.z = k
f.v = k
i.p = k
a.o = m
a.y = f
a.z = k
a.v = k
c.u = f
c.w = k
c.v = k
c.t = h
j.p = k
assert f.z.y.u.y.v.txt == "k"