class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: F = None
        self.y: B = None
        self.q: D = None
        self.z: F = None
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

e = A("e")
c = B("c")
i = C("i")
g = D("g")
f = E("f")
j = F("j")

e.u = c
e.y = c
e.w = j
e.z = j
e.q = g
e.x = f
c.q = i
i.r = e
i.z = c
g.u = c
g.y = j
g.s = e
f.s = g
f.q = g
f.t = j
f.u = i
f.v = c
j.z = f
assert i.r.y.q.z.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: F = None
        self.y: B = None
        self.q: D = None
        self.z: F = None
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

e = A("e")
c = B("c")
i = C("i")
g = D("g")
f = E("f")
j = F("j")

e.u = c
e.y = c
e.w = j
e.z = j
e.q = g
e.x = f
c.q = i
i.r = e
i.z = c
g.u = c
g.y = j
g.s = e
f.s = g
f.q = g
f.t = j
f.u = i
f.v = c
j.z = f
assert i.r.y.q.z.q.r.txt == "e"