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

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

g = A("g")
k = B("k")
f = C("f")
c = D("c")
n = E("n")
l = F("l")
a = D("a")
m = A("m")

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

g = A("g")
k = B("k")
f = C("f")
c = D("c")
n = E("n")
l = F("l")
a = D("a")
m = A("m")

g.q = k
g.y = k
g.w = k
g.v = f
k.u = g
f.t = k
f.u = k
f.s = c
c.u = n
c.t = a
n.x = f
l.v = f
a.u = n
a.t = c
m.q = k
m.y = k
m.w = k
m.v = f
assert g.q.u.y.u.v.s.u.txt == "n"