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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: G = None
        self.r: H = None
        self.u: G = None
        self.t: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: E = None
        self.x: C = None
        self.w: C = None
        self.v: E = None
        self.o: H = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: G = None
        self.r: H = None
        self.u: G = None
        self.t: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: E = None
        self.x: C = None
        self.w: C = None
        self.v: E = None
        self.o: H = None
        self.txt = txt

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

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

f.u = l
f.p = l
k.p = n
m.w = k
m.x = d
m.u = d
m.r = n
m.t = l
c.y = l
h.u = k
h.x = m
h.y = m
h.z = m
h.w = m
h.t = f
h.p = l
l.z = c
l.t = m
d.s = m
d.x = m
d.w = m
d.t = h
d.v = h
d.o = n
n.x = h
assert n.x.p.z.y.t.r.x.txt == "h"