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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: A = None
        self.r: A = None
        self.t: C = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: A = None
        self.r: A = None
        self.t: C = None
        self.u: A = None
        self.txt = txt

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

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