class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: B = None
        self.u: C = None
        self.p: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: F = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: F = None
        self.txt = txt

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

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

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

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

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