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

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

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

g = A("g")
d = B("d")
f = C("f")
b = B("b")
c = B("c")
k = C("k")
h = A("h")
j = A("j")
m = B("m")
e = A("e")

g.s = b
g.v = m
d.s = k
d.u = f
f.q = k
f.y = k
b.s = f
b.u = f
c.s = f
c.u = k
k.q = f
k.y = f
h.s = b
h.v = c
j.s = b
j.v = c
m.s = k
m.u = k
e.s = b
e.v = b
assert e.s.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.v: B = None
        self.txt = txt

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

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

g = A("g")
d = B("d")
f = C("f")
b = B("b")
c = B("c")
k = C("k")
h = A("h")
j = A("j")
m = B("m")
e = A("e")

g.s = b
g.v = m
d.s = k
d.u = f
f.q = k
f.y = k
b.s = f
b.u = f
c.s = f
c.u = k
k.q = f
k.y = f
h.s = b
h.v = c
j.s = b
j.v = c
m.s = k
m.u = k
e.s = b
e.v = b
assert e.s.s.q.txt == "k"