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

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: A = None
        self.u: B = None
        self.q: D = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: A = None
        self.r: F = None
        self.v: E = None
        self.o: D = None
        self.q: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.t: B = None
        self.txt = txt

i = A("i")
h = B("h")
m = C("m")
n = D("n")
a = E("a")
j = F("j")
g = D("g")

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

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: A = None
        self.u: B = None
        self.q: D = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: A = None
        self.r: F = None
        self.v: E = None
        self.o: D = None
        self.q: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: B = None
        self.t: B = None
        self.txt = txt

i = A("i")
h = B("h")
m = C("m")
n = D("n")
a = E("a")
j = F("j")
g = D("g")

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