class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: G = None
        self.v: E = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: E = None
        self.x: A = None
        self.u: C = None
        self.s: H = None
        self.q: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.v: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: E = None
        self.x: A = None
        self.u: C = None
        self.s: H = None
        self.q: H = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

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