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

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

class E:
    def __init__(self, txt: str):
        self.q: H = None
        self.y: F = None
        self.x: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

a.t = h
m.v = l
m.y = h
i.s = e
c.o = i
c.s = m
f.q = d
f.y = e
f.x = e
e.y = l
e.p = i
e.x = i
l.z = a
g.v = c
h.t = a
d.v = c
assert e.y.z.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: H = None
        self.y: F = None
        self.x: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

a.t = h
m.v = l
m.y = h
i.s = e
c.o = i
c.s = m
f.q = d
f.y = e
f.x = e
e.y = l
e.p = i
e.x = i
l.z = a
g.v = c
h.t = a
d.v = c
assert e.y.z.t.t.t.txt == "h"