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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: D = None
        self.p: C = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: B = None
        self.x: C = None
        self.q: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: D = None
        self.p: C = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: B = None
        self.x: C = None
        self.q: A = None
        self.txt = txt

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

b.o = m
b.w = m
m.t = a
d.z = b
d.t = h
d.v = h
d.p = j
h.y = j
h.p = a
h.x = d
h.q = b
j.z = b
j.t = h
j.v = h
j.p = d
a.t = m
assert a.t.t.t.txt == "m"