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

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

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

l = A("l")
f = B("f")
g = C("g")
a = B("a")
k = B("k")
c = A("c")
h = C("h")
d = C("d")

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

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

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

l = A("l")
f = B("f")
g = C("g")
a = B("a")
k = B("k")
c = A("c")
h = C("h")
d = C("d")

l.q = g
l.y = a
f.v = l
f.x = g
f.s = c
g.q = k
g.u = c
a.v = c
a.x = h
a.s = l
k.v = l
k.x = h
k.s = c
c.q = h
c.y = f
h.q = a
h.u = l
d.q = a
d.u = c
assert f.x.u.y.s.y.s.q.txt == "h"