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

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

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

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

m = A("m")
i = B("i")
f = C("f")
l = D("l")
n = A("n")
e = C("e")
a = D("a")

m.x = l
m.v = e
i.y = n
i.p = m
f.x = a
f.o = m
f.q = i
l.t = a
l.w = m
l.v = i
n.x = l
n.v = f
e.x = l
e.o = n
e.q = i
a.t = l
a.w = m
a.v = i
assert l.t.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: C = None
        self.txt = txt

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

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

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

m = A("m")
i = B("i")
f = C("f")
l = D("l")
n = A("n")
e = C("e")
a = D("a")

m.x = l
m.v = e
i.y = n
i.p = m
f.x = a
f.o = m
f.q = i
l.t = a
l.w = m
l.v = i
n.x = l
n.v = f
e.x = l
e.o = n
e.q = i
a.t = l
a.w = m
a.v = i
assert l.t.v.y.txt == "n"