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

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

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

g = A("g")
k = B("k")
n = C("n")
e = C("e")
h = C("h")
d = A("d")
i = B("i")
a = B("a")
j = A("j")
f = B("f")

g.y = n
k.t = h
k.x = h
k.r = f
n.s = g
e.s = d
h.s = d
d.y = h
i.t = n
i.r = k
i.x = h
a.t = n
a.r = i
a.x = e
j.y = e
f.t = n
f.x = n
f.r = k
assert d.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

g = A("g")
k = B("k")
n = C("n")
e = C("e")
h = C("h")
d = A("d")
i = B("i")
a = B("a")
j = A("j")
f = B("f")

g.y = n
k.t = h
k.x = h
k.r = f
n.s = g
e.s = d
h.s = d
d.y = h
i.t = n
i.r = k
i.x = h
a.t = n
a.r = i
a.x = e
j.y = e
f.t = n
f.x = n
f.r = k
assert d.y.s.y.txt == "h"