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

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

class C:
    def __init__(self, txt: str):
        self.t: H = None
        self.v: H = None
        self.x: D = None
        self.r: I = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: A = None
        self.t: I = None
        self.s: B = None
        self.o: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: C = None
        self.o: B = None
        self.w: B = None
        self.r: C = None
        self.q: G = None
        self.v: C = None
        self.x: A = None
        self.s: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

k = A("k")
c = B("c")
m = C("m")
j = D("j")
n = E("n")
a = F("a")
i = G("i")
l = H("l")
g = I("g")

k.p = l
k.w = m
c.z = a
m.t = l
m.v = l
m.x = j
m.r = g
j.z = l
j.s = m
j.y = a
n.x = i
a.w = m
i.y = a
i.x = k
i.t = g
i.s = c
i.o = n
l.t = c
l.o = c
l.w = c
l.y = m
l.r = m
l.v = m
l.q = i
l.x = k
l.s = j
g.p = j
assert l.s.y.w.x.y.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: H = None
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: H = None
        self.v: H = None
        self.x: D = None
        self.r: I = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: A = None
        self.t: I = None
        self.s: B = None
        self.o: E = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: B = None
        self.y: C = None
        self.o: B = None
        self.w: B = None
        self.r: C = None
        self.q: G = None
        self.v: C = None
        self.x: A = None
        self.s: D = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

k = A("k")
c = B("c")
m = C("m")
j = D("j")
n = E("n")
a = F("a")
i = G("i")
l = H("l")
g = I("g")

k.p = l
k.w = m
c.z = a
m.t = l
m.v = l
m.x = j
m.r = g
j.z = l
j.s = m
j.y = a
n.x = i
a.w = m
i.y = a
i.x = k
i.t = g
i.s = c
i.o = n
l.t = c
l.o = c
l.w = c
l.y = m
l.r = m
l.v = m
l.q = i
l.x = k
l.s = j
g.p = j
assert l.s.y.w.x.y.w.r.txt == "g"