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

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

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

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

j = A("j")
k = B("k")
a = C("a")
d = D("d")

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

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

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

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

j = A("j")
k = B("k")
a = C("a")
d = D("d")

j.u = a
j.s = k
k.o = j
a.u = k
d.t = a
assert d.t.u.o.u.txt == "a"