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

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

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

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

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

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

g = A("g")
e = B("e")
j = C("j")
a = D("a")
k = E("k")
n = F("n")

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

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

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

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

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

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

g = A("g")
e = B("e")
j = C("j")
a = D("a")
k = E("k")
n = F("n")

g.p = j
e.v = n
j.w = a
j.x = a
j.p = e
j.u = g
j.s = g
j.o = k
a.z = g
a.w = g
a.s = g
k.p = a
k.z = g
n.y = g
n.x = g
n.w = k
n.t = e
n.o = e
assert a.z.p.o.txt == "k"