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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: B = None
        self.z: D = None
        self.r: F = None
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: F = None
        self.p: E = None
        self.u: B = None
        self.x: A = None
        self.s: A = None
        self.txt = txt

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

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

k = A("k")
g = B("g")
n = C("n")
d = D("d")
m = E("m")
l = F("l")
h = C("h")

k.v = g
g.q = h
g.s = m
g.r = m
g.y = l
n.w = d
n.z = d
n.s = g
n.r = l
n.y = l
d.r = k
d.x = k
d.s = k
d.t = l
d.p = m
d.u = g
m.v = l
m.w = l
l.s = h
h.w = d
h.z = d
h.s = g
h.r = l
h.y = l
assert k.v.r.w.s.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: B = None
        self.z: D = None
        self.r: F = None
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: F = None
        self.p: E = None
        self.u: B = None
        self.x: A = None
        self.s: A = None
        self.txt = txt

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

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

k = A("k")
g = B("g")
n = C("n")
d = D("d")
m = E("m")
l = F("l")
h = C("h")

k.v = g
g.q = h
g.s = m
g.r = m
g.y = l
n.w = d
n.z = d
n.s = g
n.r = l
n.y = l
d.r = k
d.x = k
d.s = k
d.t = l
d.p = m
d.u = g
m.v = l
m.w = l
l.s = h
h.w = d
h.z = d
h.s = g
h.r = l
h.y = l
assert k.v.r.w.s.r.s.txt == "h"