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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: B = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

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

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

j = A("j")
l = B("l")
d = C("d")
e = D("e")
a = E("a")
k = F("k")

j.q = k
j.x = k
l.w = e
d.q = a
d.s = l
d.o = e
d.w = e
e.q = d
e.t = a
a.y = j
a.q = e
a.s = l
a.t = l
a.v = d
k.u = l
k.x = j
assert e.t.t.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: B = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

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

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

j = A("j")
l = B("l")
d = C("d")
e = D("e")
a = E("a")
k = F("k")

j.q = k
j.x = k
l.w = e
d.q = a
d.s = l
d.o = e
d.w = e
e.q = d
e.t = a
a.y = j
a.q = e
a.s = l
a.t = l
a.v = d
k.u = l
k.x = j
assert e.t.t.w.q.txt == "d"