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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

a = A("a")
k = B("k")
h = C("h")
i = D("i")
l = E("l")
b = F("b")

a.p = k
k.p = i
h.x = i
i.x = k
i.w = k
i.z = l
i.u = b
i.q = b
l.t = h
l.p = k
l.v = a
b.r = a
b.q = k
assert k.p.w.p.z.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

a = A("a")
k = B("k")
h = C("h")
i = D("i")
l = E("l")
b = F("b")

a.p = k
k.p = i
h.x = i
i.x = k
i.w = k
i.z = l
i.u = b
i.q = b
l.t = h
l.p = k
l.v = a
b.r = a
b.q = k
assert k.p.w.p.z.p.p.txt == "i"