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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: D = None
        self.z: B = None
        self.u: A = None
        self.txt = txt

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

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

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

m.w = j
m.r = b
a.q = b
a.s = b
a.z = c
a.u = j
e.x = l
b.w = e
b.u = f
b.p = m
h.x = e
j.w = m
j.r = b
g.q = b
g.s = b
g.z = f
g.u = m
c.q = b
c.s = b
c.z = a
c.u = j
f.q = b
f.s = b
f.z = a
f.u = j
l.x = h
assert e.x.x.x.x.x.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.s: D = None
        self.z: B = None
        self.u: A = None
        self.txt = txt

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

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

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

m.w = j
m.r = b
a.q = b
a.s = b
a.z = c
a.u = j
e.x = l
b.w = e
b.u = f
b.p = m
h.x = e
j.w = m
j.r = b
g.q = b
g.s = b
g.z = f
g.u = m
c.q = b
c.s = b
c.z = a
c.u = j
f.q = b
f.s = b
f.z = a
f.u = j
l.x = h
assert e.x.x.x.x.x.x.x.x.x.x.txt == "l"