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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: B = None
        self.v: D = None
        self.p: G = None
        self.t: G = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.o: B = None
        self.v: D = None
        self.p: G = None
        self.t: G = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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

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