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

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

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

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

n = A("n")
c = B("c")
i = C("i")
l = D("l")
f = C("f")
j = B("j")
a = A("a")
d = D("d")
g = A("g")
e = B("e")

n.s = c
c.t = f
i.o = f
i.t = j
l.x = e
f.o = i
f.t = e
j.t = f
a.s = j
d.x = j
g.s = c
e.t = f
assert i.o.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

n = A("n")
c = B("c")
i = C("i")
l = D("l")
f = C("f")
j = B("j")
a = A("a")
d = D("d")
g = A("g")
e = B("e")

n.s = c
c.t = f
i.o = f
i.t = j
l.x = e
f.o = i
f.t = e
j.t = f
a.s = j
d.x = j
g.s = c
e.t = f
assert i.o.o.t.txt == "j"