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

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

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

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

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

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

a = A("a")
j = B("j")
g = C("g")
h = D("h")
d = E("d")
k = F("k")

a.u = k
a.v = k
a.x = k
a.p = g
a.y = g
a.z = j
j.x = k
g.v = h
g.y = h
g.x = j
h.s = a
h.y = a
h.t = j
h.u = g
h.v = g
h.q = d
d.t = g
d.u = h
k.r = j
k.q = g
k.z = g
k.v = d
k.t = h
k.u = a
assert j.x.r.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: F = None
        self.p: C = None
        self.y: C = None
        self.x: F = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

a = A("a")
j = B("j")
g = C("g")
h = D("h")
d = E("d")
k = F("k")

a.u = k
a.v = k
a.x = k
a.p = g
a.y = g
a.z = j
j.x = k
g.v = h
g.y = h
g.x = j
h.s = a
h.y = a
h.t = j
h.u = g
h.v = g
h.q = d
d.t = g
d.u = h
k.r = j
k.q = g
k.z = g
k.v = d
k.t = h
k.u = a
assert j.x.r.x.q.txt == "g"