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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: F = None
        self.p: A = None
        self.u: E = None
        self.q: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: B = None
        self.y: B = None
        self.q: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: C = None
        self.r: C = None
        self.p: B = None
        self.x: E = None
        self.txt = txt

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

a.q = f
h.s = c
h.v = f
h.q = f
f.r = h
f.z = c
f.p = a
f.u = m
f.q = i
i.u = k
k.p = m
k.u = h
k.y = h
k.q = g
c.z = h
c.p = h
c.o = f
c.r = f
c.x = m
m.p = g
m.q = g
m.u = h
m.y = h
g.p = m
g.q = m
g.u = h
g.y = h
assert k.p.y.s.o.r.q.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: F = None
        self.p: A = None
        self.u: E = None
        self.q: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: B = None
        self.y: B = None
        self.q: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: C = None
        self.r: C = None
        self.p: B = None
        self.x: E = None
        self.txt = txt

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

a.q = f
h.s = c
h.v = f
h.q = f
f.r = h
f.z = c
f.p = a
f.u = m
f.q = i
i.u = k
k.p = m
k.u = h
k.y = h
k.q = g
c.z = h
c.p = h
c.o = f
c.r = f
c.x = m
m.p = g
m.q = g
m.u = h
m.y = h
g.p = m
g.q = m
g.u = h
g.y = h
assert k.p.y.s.o.r.q.z.x.txt == "m"