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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: A = None
        self.txt = txt

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

l = A("l")
k = B("k")
n = C("n")
e = D("e")
f = E("f")
a = F("a")

l.q = n
l.w = e
k.t = e
k.x = n
k.r = f
k.q = a
n.v = e
n.r = e
n.u = e
n.w = f
n.t = a
e.v = k
e.r = a
e.y = a
e.q = a
e.s = f
e.p = n
f.w = k
f.y = l
a.z = k
a.s = k
assert l.q.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: A = None
        self.txt = txt

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

l = A("l")
k = B("k")
n = C("n")
e = D("e")
f = E("f")
a = F("a")

l.q = n
l.w = e
k.t = e
k.x = n
k.r = f
k.q = a
n.v = e
n.r = e
n.u = e
n.w = f
n.t = a
e.v = k
e.r = a
e.y = a
e.q = a
e.s = f
e.p = n
f.w = k
f.y = l
a.z = k
a.s = k
assert l.q.r.s.txt == "f"