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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: C = None
        self.t: C = None
        self.y: A = 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.r: D = None
        self.o: D = None
        self.q: C = None
        self.v: C = None
        self.txt = txt

b = A("b")
d = B("d")
j = C("j")
l = D("l")
g = D("g")
h = C("h")
a = C("a")
k = B("k")
m = A("m")

b.w = g
d.p = l
d.z = a
d.t = j
d.y = b
j.o = a
l.r = g
l.o = g
l.q = h
l.v = a
g.r = l
g.o = l
g.q = a
g.v = h
h.o = j
a.o = h
k.p = l
k.z = a
k.t = j
k.y = b
m.w = l
assert h.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: C = None
        self.t: C = None
        self.y: A = 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.r: D = None
        self.o: D = None
        self.q: C = None
        self.v: C = None
        self.txt = txt

b = A("b")
d = B("d")
j = C("j")
l = D("l")
g = D("g")
h = C("h")
a = C("a")
k = B("k")
m = A("m")

b.w = g
d.p = l
d.z = a
d.t = j
d.y = b
j.o = a
l.r = g
l.o = g
l.q = h
l.v = a
g.r = l
g.o = l
g.q = a
g.v = h
h.o = j
a.o = h
k.p = l
k.z = a
k.t = j
k.y = b
m.w = l
assert h.o.o.o.txt == "h"