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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: C = None
        self.r: C = None
        self.w: A = None
        self.y: C = None
        self.p: C = None
        self.txt = txt

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

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

k = A("k")
h = B("h")
g = C("g")
l = D("l")
f = E("f")
d = F("d")

k.p = h
h.z = d
g.x = l
g.z = h
g.s = d
l.v = g
l.x = g
l.r = g
l.y = g
l.p = g
l.w = k
f.x = k
f.p = k
f.v = g
f.w = g
d.q = f
d.v = k
assert g.z.z.q.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: C = None
        self.r: C = None
        self.w: A = None
        self.y: C = None
        self.p: C = None
        self.txt = txt

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

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

k = A("k")
h = B("h")
g = C("g")
l = D("l")
f = E("f")
d = F("d")

k.p = h
h.z = d
g.x = l
g.z = h
g.s = d
l.v = g
l.x = g
l.r = g
l.y = g
l.p = g
l.w = k
f.x = k
f.p = k
f.v = g
f.w = g
d.q = f
d.v = k
assert g.z.z.q.v.z.txt == "h"