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

class B:
    def __init__(self, txt: str):
        self.o: H = None
        self.v: C = None
        self.z: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: H = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: E = None
        self.z: F = None
        self.v: B = None
        self.x: A = None
        self.txt = txt

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

l.u = i
c.o = g
c.z = g
c.v = i
i.t = g
i.r = h
f.t = n
f.y = d
f.w = h
f.p = c
f.o = i
n.v = d
d.p = l
d.w = l
d.z = c
d.t = c
h.v = i
g.q = f
g.w = n
g.z = d
g.v = c
g.x = l
assert h.v.r.v.r.v.r.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: H = None
        self.v: C = None
        self.z: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: H = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: E = None
        self.z: F = None
        self.v: B = None
        self.x: A = None
        self.txt = txt

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

l.u = i
c.o = g
c.z = g
c.v = i
i.t = g
i.r = h
f.t = n
f.y = d
f.w = h
f.p = c
f.o = i
n.v = d
d.p = l
d.w = l
d.z = c
d.t = c
h.v = i
g.q = f
g.w = n
g.z = d
g.v = c
g.x = l
assert h.v.r.v.r.v.r.v.t.txt == "g"