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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: C = None
        self.v: B = None
        self.w: C = None
        self.u: B = None
        self.txt = txt

b = A("b")
k = B("k")
n = C("n")
d = D("d")
a = E("a")
l = F("l")
c = A("c")

b.q = l
k.v = d
n.z = k
n.o = k
n.v = l
n.s = a
d.t = b
d.y = n
d.s = l
a.z = k
a.p = d
l.p = a
l.y = n
l.w = n
l.v = k
l.u = k
c.q = l
assert k.v.y.s.p.t.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.y: C = None
        self.v: B = None
        self.w: C = None
        self.u: B = None
        self.txt = txt

b = A("b")
k = B("k")
n = C("n")
d = D("d")
a = E("a")
l = F("l")
c = A("c")

b.q = l
k.v = d
n.z = k
n.o = k
n.v = l
n.s = a
d.t = b
d.y = n
d.s = l
a.z = k
a.p = d
l.p = a
l.y = n
l.w = n
l.v = k
l.u = k
c.q = l
assert k.v.y.s.p.t.q.v.txt == "k"