class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: D = None
        self.v: F = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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

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

d.y = e
d.t = k
d.v = a
d.p = n
e.u = k
e.s = a
e.x = d
e.w = n
e.v = g
g.s = k
k.p = e
n.r = k
n.y = d
n.p = g
n.w = a
n.z = e
a.v = g
a.r = e
a.y = d
assert n.y.y.x.txt == "d"