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

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: C = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: F = None
        self.s: C = None
        self.z: C = None
        self.r: D = None
        self.u: B = None
        self.txt = txt

j = A("j")
m = B("m")
k = C("k")
g = D("g")
b = E("b")
i = F("i")
a = C("a")
f = D("f")
d = F("d")

j.u = m
j.q = a
m.p = g
m.s = j
k.t = a
k.s = a
g.p = f
g.u = k
b.o = f
b.u = f
b.s = a
i.o = d
i.x = d
i.s = k
i.z = k
i.r = g
i.u = m
a.t = k
a.s = k
f.p = g
f.u = k
d.o = i
d.x = i
d.s = a
d.z = k
d.r = f
d.u = m
assert d.u.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: C = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: F = None
        self.s: C = None
        self.z: C = None
        self.r: D = None
        self.u: B = None
        self.txt = txt

j = A("j")
m = B("m")
k = C("k")
g = D("g")
b = E("b")
i = F("i")
a = C("a")
f = D("f")
d = F("d")

j.u = m
j.q = a
m.p = g
m.s = j
k.t = a
k.s = a
g.p = f
g.u = k
b.o = f
b.u = f
b.s = a
i.o = d
i.x = d
i.s = k
i.z = k
i.r = g
i.u = m
a.t = k
a.s = k
f.p = g
f.u = k
d.o = i
d.x = i
d.s = a
d.z = k
d.r = f
d.u = m
assert d.u.s.q.txt == "a"