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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: G = None
        self.z: D = None
        self.q: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: B = None
        self.t: G = None
        self.q: A = None
        self.v: A = None
        self.y: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: G = None
        self.t: H = None
        self.z: G = None
        self.p: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: H = None
        self.t: G = None
        self.o: F = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: G = None
        self.z: D = None
        self.q: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: B = None
        self.t: G = None
        self.q: A = None
        self.v: A = None
        self.y: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: G = None
        self.t: H = None
        self.z: G = None
        self.p: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: H = None
        self.t: G = None
        self.o: F = None
        self.txt = txt

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

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

h.r = k
h.u = f
a.r = h
a.u = m
a.z = n
a.q = k
f.u = h
f.q = h
f.v = h
f.p = a
f.y = a
f.t = c
n.z = d
d.y = n
d.w = c
d.z = c
d.p = c
d.t = i
k.z = a
c.r = h
c.x = i
c.t = m
c.o = k
i.v = d
m.r = h
m.x = i
m.t = c
m.o = k
j.y = n
j.w = m
j.t = i
j.z = c
j.p = c
assert d.w.r.r.txt == "k"