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

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

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

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

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

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

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

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

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