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

class B:
    def __init__(self, txt: str):
        self.r: H = None
        self.t: C = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

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

k = A("k")
h = B("h")
m = C("m")
i = D("i")
j = E("j")
e = F("e")
g = G("g")
n = H("n")
b = C("b")
c = F("c")

k.p = h
h.r = n
h.t = b
h.z = i
m.r = i
m.p = k
i.t = k
i.w = j
i.p = h
i.q = m
i.r = n
j.x = n
e.v = b
e.w = k
e.s = c
g.s = k
g.w = k
g.o = i
n.w = e
b.r = i
b.p = k
c.v = m
c.w = k
c.s = e
assert n.w.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: H = None
        self.t: C = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

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

k = A("k")
h = B("h")
m = C("m")
i = D("i")
j = E("j")
e = F("e")
g = G("g")
n = H("n")
b = C("b")
c = F("c")

k.p = h
h.r = n
h.t = b
h.z = i
m.r = i
m.p = k
i.t = k
i.w = j
i.p = h
i.q = m
i.r = n
j.x = n
e.v = b
e.w = k
e.s = c
g.s = k
g.w = k
g.o = i
n.w = e
b.r = i
b.p = k
c.v = m
c.w = k
c.s = e
assert n.w.v.p.txt == "k"