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

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

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

i = A("i")
d = B("d")
m = C("m")
g = C("g")
h = B("h")
k = A("k")
c = A("c")
f = C("f")
l = B("l")
n = B("n")

i.s = k
i.u = m
i.t = c
d.q = g
m.y = i
m.x = c
g.y = k
g.x = c
h.q = g
k.s = i
k.t = i
k.u = g
c.s = i
c.u = g
c.t = k
f.y = k
f.x = c
l.q = g
n.q = g
assert m.y.s.t.u.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: C = None
        self.t: A = None
        self.txt = txt

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

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

i = A("i")
d = B("d")
m = C("m")
g = C("g")
h = B("h")
k = A("k")
c = A("c")
f = C("f")
l = B("l")
n = B("n")

i.s = k
i.u = m
i.t = c
d.q = g
m.y = i
m.x = c
g.y = k
g.x = c
h.q = g
k.s = i
k.t = i
k.u = g
c.s = i
c.u = g
c.t = k
f.y = k
f.x = c
l.q = g
n.q = g
assert m.y.s.t.u.y.t.txt == "c"