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

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

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.o: D = None
        self.p: B = None
        self.x: F = None
        self.r: B = None
        self.s: F = None
        self.z: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.w: D = None
        self.p: D = None
        self.u: A = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.o: D = None
        self.p: B = None
        self.x: F = None
        self.r: B = None
        self.s: F = None
        self.z: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.w: D = None
        self.p: D = None
        self.u: A = None
        self.txt = txt

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

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

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