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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

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

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

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

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

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