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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: C = None
        self.u: C = None
        self.r: A = None
        self.txt = txt

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

g = A("g")
f = B("f")
i = C("i")
l = D("l")
j = E("j")
k = F("k")

g.q = k
f.v = g
f.s = i
i.o = k
i.s = k
i.u = f
i.t = g
i.q = j
l.q = i
l.w = f
j.s = g
j.r = g
j.q = i
j.u = i
k.x = g
k.v = g
k.r = l
k.z = i
k.y = f
assert i.t.q.z.s.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: C = None
        self.u: C = None
        self.r: A = None
        self.txt = txt

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

g = A("g")
f = B("f")
i = C("i")
l = D("l")
j = E("j")
k = F("k")

g.q = k
f.v = g
f.s = i
i.o = k
i.s = k
i.u = f
i.t = g
i.q = j
l.q = i
l.w = f
j.s = g
j.r = g
j.q = i
j.u = i
k.x = g
k.v = g
k.r = l
k.z = i
k.y = f
assert i.t.q.z.s.r.w.txt == "f"