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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.r: F = None
        self.v: A = None
        self.q: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

b = A("b")
a = B("a")
l = C("l")
m = D("m")
g = E("g")
d = F("d")

b.u = a
b.z = l
a.w = d
a.r = d
a.v = b
a.q = m
a.s = m
l.s = m
l.w = a
m.x = l
m.w = b
m.y = b
m.t = a
g.q = b
d.v = m
d.p = m
d.u = m
d.z = g
d.x = l
d.w = l
assert d.u.y.u.w.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.r: F = None
        self.v: A = None
        self.q: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

b = A("b")
a = B("a")
l = C("l")
m = D("m")
g = E("g")
d = F("d")

b.u = a
b.z = l
a.w = d
a.r = d
a.v = b
a.q = m
a.s = m
l.s = m
l.w = a
m.x = l
m.w = b
m.y = b
m.t = a
g.q = b
d.v = m
d.p = m
d.u = m
d.z = g
d.x = l
d.w = l
assert d.u.y.u.w.z.q.txt == "b"