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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: A = None
        self.x: B = None
        self.v: D = 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.x: B = None
        self.txt = txt

l = A("l")
b = B("b")
m = C("m")
n = D("n")
a = B("a")
e = C("e")
j = B("j")

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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: A = None
        self.x: B = None
        self.v: D = 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.x: B = None
        self.txt = txt

l = A("l")
b = B("b")
m = C("m")
n = D("n")
a = B("a")
e = C("e")
j = B("j")

l.w = n
b.t = a
b.o = l
b.x = j
b.v = n
m.y = n
n.x = b
a.t = b
a.o = l
a.x = j
a.v = n
e.y = n
j.t = b
j.x = b
j.o = l
j.v = n
assert n.x.o.w.txt == "n"