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

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

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

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

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

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

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

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

h.t = l
h.z = m
a.t = h
a.s = h
a.p = d
e.z = h
m.w = l
m.u = d
m.s = h
i.z = a
l.o = d
l.r = m
l.x = m
l.p = a
l.s = i
l.y = e
d.x = l
assert h.t.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

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

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

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