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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

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

f.t = h
f.s = l
f.z = l
i.x = h
h.p = i
m.s = e
m.x = k
m.r = l
l.z = i
l.q = f
l.u = e
e.t = h
e.x = f
k.p = d
k.o = n
n.s = e
n.x = k
n.r = l
g.p = i
g.o = n
d.x = h
assert e.x.t.p.x.p.x.p.x.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: E = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

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

f.t = h
f.s = l
f.z = l
i.x = h
h.p = i
m.s = e
m.x = k
m.r = l
l.z = i
l.q = f
l.u = e
e.t = h
e.x = f
k.p = d
k.o = n
n.s = e
n.x = k
n.r = l
g.p = i
g.o = n
d.x = h
assert e.x.t.p.x.p.x.p.x.p.x.txt == "h"