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

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

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

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

i.t = j
i.x = e
a.s = i
a.v = g
h.s = a
h.t = j
b.s = a
b.t = i
e.s = g
e.t = j
g.s = c
g.v = a
j.t = i
j.x = b
m.s = g
m.t = c
d.s = a
d.t = i
c.t = j
c.x = e
assert d.s.v.s.x.s.v.s.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: C = None
        self.txt = txt

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

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

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

i.t = j
i.x = e
a.s = i
a.v = g
h.s = a
h.t = j
b.s = a
b.t = i
e.s = g
e.t = j
g.s = c
g.v = a
j.t = i
j.x = b
m.s = g
m.t = c
d.s = a
d.t = i
c.t = j
c.x = e
assert d.s.v.s.x.s.v.s.t.x.txt == "b"