class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: C = None
        self.z: C = None
        self.t: C = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: A = None
        self.t: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

l.q = e
l.p = j
l.z = b
l.t = b
l.w = b
g.u = l
j.z = g
j.r = g
j.q = g
j.t = f
k.s = l
k.p = l
k.t = f
e.p = k
e.q = l
e.u = b
f.r = b
b.z = g
b.r = g
b.q = g
b.t = f
assert l.q.p.t.r.r.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.p: C = None
        self.z: C = None
        self.t: C = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: A = None
        self.t: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

l.q = e
l.p = j
l.z = b
l.t = b
l.w = b
g.u = l
j.z = g
j.r = g
j.q = g
j.t = f
k.s = l
k.p = l
k.t = f
e.p = k
e.q = l
e.u = b
f.r = b
b.z = g
b.r = g
b.q = g
b.t = f
assert l.q.p.t.r.r.u.q.txt == "e"