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

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

class C:
    def __init__(self, txt: str):
        self.s: E = 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.v: A = None
        self.txt = txt

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

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

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

h.v = e
h.s = e
h.y = c
a.y = b
a.r = h
e.s = l
c.u = h
l.v = h
b.p = e
b.q = e
d.u = c
d.o = b
d.z = e
assert e.s.v.v.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: C = None
        self.y: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: E = 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.v: A = None
        self.txt = txt

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

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

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

h.v = e
h.s = e
h.y = c
a.y = b
a.r = h
e.s = l
c.u = h
l.v = h
b.p = e
b.q = e
d.u = c
d.o = b
d.z = e
assert e.s.v.v.s.v.txt == "h"