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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.s: G = None
        self.o: C = None
        self.t: A = None
        self.z: B = None
        self.x: B = None
        self.v: G = None
        self.txt = txt

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

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

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

l.t = g
h.s = i
h.r = m
e.x = m
n.s = l
m.q = g
m.s = g
m.v = g
m.o = e
m.t = l
m.z = h
m.x = h
i.z = g
i.s = l
g.y = i
g.o = n
g.w = n
g.v = h
assert e.x.x.r.t.t.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: G = None
        self.s: G = None
        self.o: C = None
        self.t: A = None
        self.z: B = None
        self.x: B = None
        self.v: G = None
        self.txt = txt

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

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

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

l.t = g
h.s = i
h.r = m
e.x = m
n.s = l
m.q = g
m.s = g
m.v = g
m.o = e
m.t = l
m.z = h
m.x = h
i.z = g
i.s = l
g.y = i
g.o = n
g.w = n
g.v = h
assert e.x.x.r.t.t.y.s.txt == "l"