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

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

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

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

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

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

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

d.q = g
d.t = n
e.q = d
l.v = d
k.o = e
k.y = l
k.q = l
k.w = d
n.q = e
n.w = e
n.u = l
n.t = d
n.x = b
n.r = k
g.x = e
b.v = d
assert n.x.v.t.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

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

d.q = g
d.t = n
e.q = d
l.v = d
k.o = e
k.y = l
k.q = l
k.w = d
n.q = e
n.w = e
n.u = l
n.t = d
n.x = b
n.r = k
g.x = e
b.v = d
assert n.x.v.t.x.v.txt == "d"