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

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

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

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

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

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

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

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

f.q = e
f.s = a
f.t = l
d.v = f
b.r = l
b.y = m
b.q = m
m.v = f
n.r = l
n.y = d
n.q = g
a.q = f
a.s = e
a.t = b
g.v = a
l.r = b
l.y = m
l.q = d
e.q = a
e.s = f
e.t = b
assert m.v.q.s.t.y.txt == "m"