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

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

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

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

b = A("b")
l = B("l")
d = C("d")
f = D("f")
j = D("j")
e = D("e")
m = C("m")
k = B("k")
a = A("a")

b.x = a
l.t = j
l.w = j
l.s = d
l.x = a
d.u = a
d.w = m
f.o = m
f.x = m
f.y = e
f.u = k
j.o = m
j.y = f
j.x = d
j.u = k
e.o = m
e.x = m
e.y = j
e.u = l
m.u = b
m.w = d
k.t = e
k.w = j
k.s = m
k.x = a
a.x = b
assert m.w.u.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

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

b = A("b")
l = B("l")
d = C("d")
f = D("f")
j = D("j")
e = D("e")
m = C("m")
k = B("k")
a = A("a")

b.x = a
l.t = j
l.w = j
l.s = d
l.x = a
d.u = a
d.w = m
f.o = m
f.x = m
f.y = e
f.u = k
j.o = m
j.y = f
j.x = d
j.u = k
e.o = m
e.x = m
e.y = j
e.u = l
m.u = b
m.w = d
k.t = e
k.w = j
k.s = m
k.x = a
a.x = b
assert m.w.u.x.x.x.x.x.x.txt == "a"