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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: D = None
        self.w: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: C = None
        self.w: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: A = None
        self.y: D = None
        self.u: F = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: D = None
        self.w: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: C = None
        self.w: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: A = None
        self.y: D = None
        self.u: F = None
        self.txt = txt

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

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

g.x = n
g.w = n
g.p = m
n.z = e
n.v = j
n.w = k
k.p = m
j.x = n
j.t = k
j.w = e
e.z = g
e.r = g
e.y = j
e.u = m
m.o = g
m.v = g
m.y = g
m.x = k
m.w = e
m.q = n
assert n.z.u.y.x.z.txt == "e"