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.s: A = None
        self.w: C = None
        self.y: A = None
        self.txt = txt

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

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

h.s = j
h.o = b
b.s = d
b.w = e
b.y = j
c.v = e
c.t = b
e.v = c
e.t = m
m.s = f
m.w = c
m.y = j
d.s = g
d.o = b
j.s = h
j.o = m
f.s = j
f.o = b
g.s = d
g.o = b
assert c.v.v.t.y.s.s.s.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.s: A = None
        self.w: C = None
        self.y: A = None
        self.txt = txt

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

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

h.s = j
h.o = b
b.s = d
b.w = e
b.y = j
c.v = e
c.t = b
e.v = c
e.t = m
m.s = f
m.w = c
m.y = j
d.s = g
d.o = b
j.s = h
j.o = m
f.s = j
f.o = b
g.s = d
g.o = b
assert c.v.v.t.y.s.s.s.txt == "h"