class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: D = None
        self.u: C = None
        self.o: B = None
        self.txt = txt

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

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

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

c = A("c")
b = B("b")
a = C("a")
h = D("h")
n = D("n")
d = A("d")

c.r = d
c.z = h
c.u = a
c.o = b
b.o = a
b.t = n
a.o = h
a.p = b
a.x = c
a.w = d
h.x = a
h.p = a
h.o = b
n.x = a
n.p = a
n.o = b
d.r = c
d.z = h
d.u = a
d.o = b
assert b.t.o.o.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: D = None
        self.u: C = None
        self.o: B = None
        self.txt = txt

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

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

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

c = A("c")
b = B("b")
a = C("a")
h = D("h")
n = D("n")
d = A("d")

c.r = d
c.z = h
c.u = a
c.o = b
b.o = a
b.t = n
a.o = h
a.p = b
a.x = c
a.w = d
h.x = a
h.p = a
h.o = b
n.x = a
n.p = a
n.o = b
d.r = c
d.z = h
d.u = a
d.o = b
assert b.t.o.o.w.z.txt == "h"