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

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

m.s = b
m.q = b
m.y = f
d.s = f
d.u = b
a.u = d
a.z = n
a.o = m
j.t = d
b.p = a
b.o = m
b.u = j
b.s = n
f.s = b
f.p = d
n.u = d
n.z = a
n.o = m
assert j.t.s.s.p.u.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: E = None
        self.y: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

m.s = b
m.q = b
m.y = f
d.s = f
d.u = b
a.u = d
a.z = n
a.o = m
j.t = d
b.p = a
b.o = m
b.u = j
b.s = n
f.s = b
f.p = d
n.u = d
n.z = a
n.o = m
assert j.t.s.s.p.u.s.p.txt == "d"