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

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

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

d = A("d")
c = B("c")
g = C("g")
b = A("b")
k = C("k")
e = B("e")
j = B("j")

d.o = e
d.t = b
d.s = b
c.w = b
g.s = k
g.z = d
g.x = d
b.o = e
b.t = d
b.s = d
k.s = g
k.z = d
k.x = d
e.w = b
j.w = d
assert j.w.o.w.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: A = None
        self.s: A = None
        self.txt = txt

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

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

d = A("d")
c = B("c")
g = C("g")
b = A("b")
k = C("k")
e = B("e")
j = B("j")

d.o = e
d.t = b
d.s = b
c.w = b
g.s = k
g.z = d
g.x = d
b.o = e
b.t = d
b.s = d
k.s = g
k.z = d
k.x = d
e.w = b
j.w = d
assert j.w.o.w.t.o.txt == "e"