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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: E = None
        self.t: F = None
        self.z: C = None
        self.txt = txt

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

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

a = A("a")
m = B("m")
k = C("k")
e = D("e")
d = E("d")
l = F("l")
n = F("n")

a.w = d
m.y = a
m.p = a
k.y = m
k.t = e
e.p = k
e.z = k
e.v = d
e.t = n
d.r = a
d.q = e
d.v = l
l.s = a
n.s = a
assert e.v.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: E = None
        self.t: F = None
        self.z: C = None
        self.txt = txt

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

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

a = A("a")
m = B("m")
k = C("k")
e = D("e")
d = E("d")
l = F("l")
n = F("n")

a.w = d
m.y = a
m.p = a
k.y = m
k.t = e
e.p = k
e.z = k
e.v = d
e.t = n
d.r = a
d.q = e
d.v = l
l.s = a
n.s = a
assert e.v.q.p.txt == "k"