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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: F = None
        self.s: A = None
        self.u: B = None
        self.w: A = None
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: A = None
        self.x: D = None
        self.t: C = None
        self.txt = txt

f = A("f")
c = B("c")
m = C("m")
a = D("a")
n = E("n")
g = F("g")

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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: F = None
        self.s: A = None
        self.u: B = None
        self.w: A = None
        self.q: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: A = None
        self.x: D = None
        self.t: C = None
        self.txt = txt

f = A("f")
c = B("c")
m = C("m")
a = D("a")
n = E("n")
g = F("g")

f.z = n
f.v = n
f.o = n
f.t = g
f.y = g
f.q = m
c.u = n
m.y = n
a.x = c
n.v = f
n.s = f
n.w = f
n.q = f
n.p = g
n.u = c
g.y = m
g.t = m
g.q = f
g.x = a
assert n.p.t.y.p.x.x.txt == "c"