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

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

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

g = A("g")
l = B("l")
c = C("c")
f = A("f")
n = C("n")
d = C("d")
m = B("m")
j = C("j")
b = C("b")
a = C("a")

g.t = a
l.r = g
l.s = f
c.y = j
c.s = n
f.t = j
n.y = a
n.s = j
d.y = b
d.s = a
m.r = f
m.s = g
j.y = a
j.s = c
b.y = j
b.s = a
a.y = j
a.s = j
assert j.y.y.y.y.s.y.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

g = A("g")
l = B("l")
c = C("c")
f = A("f")
n = C("n")
d = C("d")
m = B("m")
j = C("j")
b = C("b")
a = C("a")

g.t = a
l.r = g
l.s = f
c.y = j
c.s = n
f.t = j
n.y = a
n.s = j
d.y = b
d.s = a
m.r = f
m.s = g
j.y = a
j.s = c
b.y = j
b.s = a
a.y = j
a.s = j
assert j.y.y.y.y.s.y.y.s.txt == "j"