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

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

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

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

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

n.t = h
b.t = d
b.o = n
b.w = h
h.u = a
j.u = n
j.s = n
d.u = n
d.s = n
a.u = n
a.s = n
assert j.s.t.u.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

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

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

n.t = h
b.t = d
b.o = n
b.w = h
h.u = a
j.u = n
j.s = n
d.u = n
d.s = n
a.u = n
a.s = n
assert j.s.t.u.s.t.txt == "h"