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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: B = None
        self.s: A = None
        self.txt = txt

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

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

b.t = k
h.w = n
h.p = c
h.s = k
h.o = k
c.r = k
c.x = n
c.s = b
k.p = n
k.y = b
k.r = c
k.z = c
n.w = h
n.p = c
n.s = k
n.o = k
assert h.s.z.r.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: B = None
        self.s: A = None
        self.txt = txt

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

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

b.t = k
h.w = n
h.p = c
h.s = k
h.o = k
c.r = k
c.x = n
c.s = b
k.p = n
k.y = b
k.r = c
k.z = c
n.w = h
n.p = c
n.s = k
n.o = k
assert h.s.z.r.y.t.txt == "k"