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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.w: A = None
        self.z: B = None
        self.p: B = None
        self.q: D = None
        self.u: H = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: D = None
        self.p: D = None
        self.u: H = None
        self.s: C = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: H = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.w: A = None
        self.z: B = None
        self.p: B = None
        self.q: D = None
        self.u: H = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: D = None
        self.p: D = None
        self.u: H = None
        self.s: C = None
        self.txt = txt

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

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

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