class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: H = None
        self.s: E = None
        self.p: G = None
        self.t: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: H = None
        self.r: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: D = None
        self.r: E = None
        self.w: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.y: F = None
        self.o: A = None
        self.z: E = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: H = None
        self.r: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: D = None
        self.r: E = None
        self.w: G = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.y: F = None
        self.o: A = None
        self.z: E = None
        self.txt = txt

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

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