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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: F = None
        self.u: B = None
        self.x: C = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: F = None
        self.v: A = None
        self.x: A = None
        self.q: F = None
        self.z: E = None
        self.txt = txt

m = A("m")
e = B("e")
f = C("f")
n = D("n")
h = E("h")
i = F("i")
k = F("k")
j = F("j")

m.s = e
m.q = n
m.p = n
e.s = h
f.o = m
n.s = k
n.y = h
n.o = m
h.y = f
h.x = f
h.t = j
h.u = e
h.p = m
i.u = n
i.y = j
i.v = m
i.x = m
i.q = k
i.z = h
k.u = n
k.y = i
k.q = i
k.v = m
k.x = m
k.z = h
j.u = n
j.y = k
j.q = k
j.v = m
j.x = m
j.z = h
assert j.u.y.y.o.q.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: D = None
        self.p: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: F = None
        self.u: B = None
        self.x: C = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.y: F = None
        self.v: A = None
        self.x: A = None
        self.q: F = None
        self.z: E = None
        self.txt = txt

m = A("m")
e = B("e")
f = C("f")
n = D("n")
h = E("h")
i = F("i")
k = F("k")
j = F("j")

m.s = e
m.q = n
m.p = n
e.s = h
f.o = m
n.s = k
n.y = h
n.o = m
h.y = f
h.x = f
h.t = j
h.u = e
h.p = m
i.u = n
i.y = j
i.v = m
i.x = m
i.q = k
i.z = h
k.u = n
k.y = i
k.q = i
k.v = m
k.x = m
k.z = h
j.u = n
j.y = k
j.q = k
j.v = m
j.x = m
j.z = h
assert j.u.y.y.o.q.y.x.txt == "f"