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

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: B = None
        self.x: C = None
        self.q: B = None
        self.z: A = None
        self.r: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: E = None
        self.x: E = None
        self.u: A = None
        self.o: E = None
        self.w: C = None
        self.txt = txt

i = A("i")
f = B("f")
a = C("a")
k = D("k")
n = E("n")
b = F("b")
m = C("m")
j = E("j")

i.q = a
i.w = a
i.r = b
i.z = k
f.y = k
f.x = k
f.z = j
f.o = j
f.t = b
f.q = b
a.v = i
k.w = i
k.z = i
k.t = f
k.q = f
k.r = f
k.x = a
n.z = b
n.x = k
n.p = m
b.q = k
b.v = n
b.x = n
b.u = i
b.o = j
b.w = a
m.v = i
j.z = b
j.x = k
j.p = m
assert j.p.v.r.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: F = None
        self.z: D = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: B = None
        self.x: C = None
        self.q: B = None
        self.z: A = None
        self.r: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: E = None
        self.x: E = None
        self.u: A = None
        self.o: E = None
        self.w: C = None
        self.txt = txt

i = A("i")
f = B("f")
a = C("a")
k = D("k")
n = E("n")
b = F("b")
m = C("m")
j = E("j")

i.q = a
i.w = a
i.r = b
i.z = k
f.y = k
f.x = k
f.z = j
f.o = j
f.t = b
f.q = b
a.v = i
k.w = i
k.z = i
k.t = f
k.q = f
k.r = f
k.x = a
n.z = b
n.x = k
n.p = m
b.q = k
b.v = n
b.x = n
b.u = i
b.o = j
b.w = a
m.v = i
j.z = b
j.x = k
j.p = m
assert j.p.v.r.q.z.txt == "i"