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

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

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

d = A("d")
c = B("c")
j = C("j")
a = A("a")
n = C("n")
g = A("g")

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

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

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

d = A("d")
c = B("c")
j = C("j")
a = A("a")
n = C("n")
g = A("g")

d.o = j
c.t = a
j.s = d
j.u = a
a.o = j
n.s = a
n.u = a
g.o = n
assert c.t.o.s.o.s.o.txt == "j"