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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: F = None
        self.p: F = None
        self.q: A = None
        self.t: B = None
        self.txt = txt

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

d = A("d")
i = B("i")
k = C("k")
n = D("n")
f = E("f")
h = F("h")

d.q = h
d.x = i
d.w = k
i.p = k
i.s = k
i.y = d
i.x = f
k.q = d
n.v = h
n.q = k
n.r = k
n.z = d
n.y = f
f.u = i
f.t = i
f.y = h
f.p = h
f.q = d
h.w = n
h.z = f
h.s = i
h.t = k
assert n.v.t.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: B = None
        self.w: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: F = None
        self.p: F = None
        self.q: A = None
        self.t: B = None
        self.txt = txt

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

d = A("d")
i = B("i")
k = C("k")
n = D("n")
f = E("f")
h = F("h")

d.q = h
d.x = i
d.w = k
i.p = k
i.s = k
i.y = d
i.x = f
k.q = d
n.v = h
n.q = k
n.r = k
n.z = d
n.y = f
f.u = i
f.t = i
f.y = h
f.p = h
f.q = d
h.w = n
h.z = f
h.s = i
h.t = k
assert n.v.t.q.x.txt == "i"