class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: D = 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.s: D = None
        self.txt = txt

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

n = A("n")
l = B("l")
a = C("a")
d = D("d")
i = A("i")
c = B("c")

n.u = i
n.y = d
l.o = n
a.s = d
d.t = a
i.u = n
i.y = d
c.o = i
assert c.o.y.t.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: D = 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.s: D = None
        self.txt = txt

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

n = A("n")
l = B("l")
a = C("a")
d = D("d")
i = A("i")
c = B("c")

n.u = i
n.y = d
l.o = n
a.s = d
d.t = a
i.u = n
i.y = d
c.o = i
assert c.o.y.t.s.t.s.txt == "d"