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

class B:
    def __init__(self, txt: str):
        self.t: G = None
        self.z: A = None
        self.r: C = None
        self.v: E = None
        self.y: C = None
        self.x: C = None
        self.p: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: A = None
        self.q: E = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: G = None
        self.z: A = None
        self.r: C = None
        self.v: E = None
        self.y: C = None
        self.x: C = None
        self.p: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: A = None
        self.q: E = None
        self.txt = txt

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

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

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