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

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

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

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

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

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

k = A("k")
g = B("g")
e = C("e")
c = D("c")
n = E("n")
d = F("d")

k.y = c
k.q = e
k.p = n
k.x = n
g.q = k
g.v = k
g.r = n
g.t = c
e.p = g
e.v = g
e.y = g
e.o = n
e.u = k
e.x = d
c.u = n
n.r = g
n.p = g
d.p = e
d.q = e
d.y = e
d.z = k
d.t = g
assert n.p.v.x.r.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.q: C = None
        self.p: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

k = A("k")
g = B("g")
e = C("e")
c = D("c")
n = E("n")
d = F("d")

k.y = c
k.q = e
k.p = n
k.x = n
g.q = k
g.v = k
g.r = n
g.t = c
e.p = g
e.v = g
e.y = g
e.o = n
e.u = k
e.x = d
c.u = n
n.r = g
n.p = g
d.p = e
d.q = e
d.y = e
d.z = k
d.t = g
assert n.p.v.x.r.q.y.txt == "c"