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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

h = A("h")
m = B("m")
n = C("n")
l = D("l")
e = E("e")
j = F("j")
a = G("a")

h.r = l
h.u = m
m.v = a
m.o = a
m.y = l
n.s = j
l.o = h
l.p = a
l.r = n
l.z = m
e.x = a
j.u = h
j.w = n
a.s = m
assert h.u.y.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

h = A("h")
m = B("m")
n = C("n")
l = D("l")
e = E("e")
j = F("j")
a = G("a")

h.r = l
h.u = m
m.v = a
m.o = a
m.y = l
n.s = j
l.o = h
l.p = a
l.r = n
l.z = m
e.x = a
j.u = h
j.w = n
a.s = m
assert h.u.y.z.y.z.txt == "m"