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

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

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

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

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

a.x = m
a.v = m
a.w = b
a.y = g
f.v = e
f.o = g
f.t = g
f.q = c
m.o = e
c.w = b
c.y = g
c.u = h
c.x = h
l.w = a
l.y = g
l.u = c
l.x = c
b.x = m
b.v = m
b.w = a
b.y = f
g.v = m
g.o = f
g.t = f
g.q = h
e.o = m
h.w = b
h.y = g
h.u = c
h.x = l
k.w = b
k.y = g
k.u = h
k.x = l
assert a.x.o.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: C = None
        self.w: A = None
        self.y: B = None
        self.txt = txt

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

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

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

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

a.x = m
a.v = m
a.w = b
a.y = g
f.v = e
f.o = g
f.t = g
f.q = c
m.o = e
c.w = b
c.y = g
c.u = h
c.x = h
l.w = a
l.y = g
l.u = c
l.x = c
b.x = m
b.v = m
b.w = a
b.y = f
g.v = m
g.o = f
g.t = f
g.q = h
e.o = m
h.w = b
h.y = g
h.u = c
h.x = l
k.w = b
k.y = g
k.u = h
k.x = l
assert a.x.o.o.o.o.o.o.o.o.txt == "m"