class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: B = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

n = A("n")
j = B("j")
a = C("a")
m = D("m")
e = E("e")
d = F("d")

n.y = m
j.z = e
j.o = n
j.v = a
j.u = a
j.t = m
j.x = d
a.y = e
a.s = n
m.z = e
m.t = e
m.r = j
e.p = a
d.t = n
assert a.y.p.y.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: B = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

n = A("n")
j = B("j")
a = C("a")
m = D("m")
e = E("e")
d = F("d")

n.y = m
j.z = e
j.o = n
j.v = a
j.u = a
j.t = m
j.x = d
a.y = e
a.s = n
m.z = e
m.t = e
m.r = j
e.p = a
d.t = n
assert a.y.p.y.p.y.txt == "e"