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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: D = None
        self.s: D = None
        self.w: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: D = None
        self.t: G = None
        self.x: D = None
        self.u: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: F = None
        self.s: A = None
        self.r: E = None
        self.z: F = None
        self.u: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: D = None
        self.s: D = None
        self.w: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: D = None
        self.t: G = None
        self.x: D = None
        self.u: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: F = None
        self.s: A = None
        self.r: E = None
        self.z: F = None
        self.u: B = None
        self.txt = txt

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

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