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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: B = None
        self.p: B = None
        self.w: D = None
        self.txt = txt

k = A("k")
h = B("h")
a = C("a")
d = D("d")
b = E("b")
f = F("f")

k.v = d
k.w = b
h.u = k
h.w = k
a.x = h
a.z = d
a.u = f
d.z = f
d.v = f
d.w = b
d.r = b
d.p = a
d.t = h
b.u = a
b.q = h
b.y = h
f.o = b
f.v = h
f.p = h
f.w = d
assert h.u.w.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: B = None
        self.p: B = None
        self.w: D = None
        self.txt = txt

k = A("k")
h = B("h")
a = C("a")
d = D("d")
b = E("b")
f = F("f")

k.v = d
k.w = b
h.u = k
h.w = k
a.x = h
a.z = d
a.u = f
d.z = f
d.v = f
d.w = b
d.r = b
d.p = a
d.t = h
b.u = a
b.q = h
b.y = h
f.o = b
f.v = h
f.p = h
f.w = d
assert h.u.w.q.w.txt == "k"