class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: D = None
        self.v: B = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: B = None
        self.p: E = None
        self.w: A = None
        self.t: D = None
        self.z: A = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

k = A("k")
b = B("b")
c = C("c")
g = D("g")
f = E("f")
a = F("a")
m = G("m")
i = H("i")
h = A("h")

k.p = c
k.s = c
k.y = g
k.v = b
b.x = i
c.r = g
c.t = g
c.o = b
c.p = f
c.w = h
c.z = h
g.s = m
f.r = m
f.v = a
f.x = i
a.v = b
m.p = a
i.u = m
h.p = c
h.s = c
h.y = g
h.v = b
assert m.p.v.x.u.p.v.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: D = None
        self.v: B = None
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: B = None
        self.p: E = None
        self.w: A = None
        self.t: D = None
        self.z: A = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

k = A("k")
b = B("b")
c = C("c")
g = D("g")
f = E("f")
a = F("a")
m = G("m")
i = H("i")
h = A("h")

k.p = c
k.s = c
k.y = g
k.v = b
b.x = i
c.r = g
c.t = g
c.o = b
c.p = f
c.w = h
c.z = h
g.s = m
f.r = m
f.v = a
f.x = i
a.v = b
m.p = a
i.u = m
h.p = c
h.s = c
h.y = g
h.v = b
assert m.p.v.x.u.p.v.x.u.txt == "m"