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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: A = None
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: B = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: G = None
        self.u: D = None
        self.q: E = None
        self.r: G = None
        self.txt = txt

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

h = A("h")
i = B("i")
l = C("l")
k = D("k")
c = E("c")
g = F("g")
j = G("j")
f = B("f")
e = C("e")
a = G("a")

h.p = c
i.o = f
i.t = f
i.r = e
i.y = c
i.w = g
l.q = k
l.y = h
k.z = c
k.x = h
k.o = e
c.s = f
c.x = i
c.z = k
g.y = l
g.p = j
g.u = k
g.q = c
g.r = a
j.s = f
j.t = h
j.z = e
f.o = i
f.t = i
f.r = l
f.y = c
f.w = g
e.q = k
e.y = h
a.s = f
a.t = h
a.z = l
assert h.p.x.r.y.p.x.o.w.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: A = None
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: B = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: G = None
        self.u: D = None
        self.q: E = None
        self.r: G = None
        self.txt = txt

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

h = A("h")
i = B("i")
l = C("l")
k = D("k")
c = E("c")
g = F("g")
j = G("j")
f = B("f")
e = C("e")
a = G("a")

h.p = c
i.o = f
i.t = f
i.r = e
i.y = c
i.w = g
l.q = k
l.y = h
k.z = c
k.x = h
k.o = e
c.s = f
c.x = i
c.z = k
g.y = l
g.p = j
g.u = k
g.q = c
g.r = a
j.s = f
j.t = h
j.z = e
f.o = i
f.t = i
f.r = l
f.y = c
f.w = g
e.q = k
e.y = h
a.s = f
a.t = h
a.z = l
assert h.p.x.r.y.p.x.o.w.u.x.txt == "h"