class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: F = None
        self.v: B = None
        self.t: C = None
        self.s: D = None
        self.z: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: G = None
        self.v: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: C = None
        self.q: G = None
        self.p: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: D = None
        self.x: F = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: G = None
        self.v: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: C = None
        self.q: G = None
        self.p: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: D = None
        self.x: F = None
        self.txt = txt

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

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