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

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

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

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

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

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

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

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

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