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

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

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

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

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

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

j = A("j")
g = B("g")
c = C("c")
m = D("m")
e = E("e")
f = F("f")
d = A("d")
a = C("a")

j.u = m
g.y = c
g.q = e
g.v = e
g.s = f
g.w = m
c.q = j
c.x = d
c.y = g
c.o = a
m.s = e
m.v = g
m.u = c
e.s = f
e.x = f
e.t = j
f.z = e
f.t = e
f.v = d
f.s = d
f.q = g
d.u = m
a.q = d
a.x = j
a.y = g
a.o = c
assert d.u.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

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

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

j = A("j")
g = B("g")
c = C("c")
m = D("m")
e = E("e")
f = F("f")
d = A("d")
a = C("a")

j.u = m
g.y = c
g.q = e
g.v = e
g.s = f
g.w = m
c.q = j
c.x = d
c.y = g
c.o = a
m.s = e
m.v = g
m.u = c
e.s = f
e.x = f
e.t = j
f.z = e
f.t = e
f.v = d
f.s = d
f.q = g
d.u = m
a.q = d
a.x = j
a.y = g
a.o = c
assert d.u.u.q.txt == "j"