class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: B = None
        self.y: E = None
        self.w: E = None
        self.z: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: F = None
        self.p: E = None
        self.y: B = None
        self.txt = txt

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

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

l.q = k
l.u = c
l.y = n
l.w = n
l.z = n
c.t = h
c.u = h
c.y = a
a.y = k
a.s = l
a.t = c
a.q = n
k.p = h
k.z = f
k.q = c
f.t = n
f.p = n
f.s = h
f.y = c
h.q = a
n.t = f
n.p = f
n.s = h
n.y = c
assert k.q.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: B = None
        self.y: E = None
        self.w: E = None
        self.z: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: F = None
        self.p: E = None
        self.y: B = None
        self.txt = txt

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

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

l.q = k
l.u = c
l.y = n
l.w = n
l.z = n
c.t = h
c.u = h
c.y = a
a.y = k
a.s = l
a.t = c
a.q = n
k.p = h
k.z = f
k.q = c
f.t = n
f.p = n
f.s = h
f.y = c
h.q = a
n.t = f
n.p = f
n.s = h
n.y = c
assert k.q.u.q.txt == "a"