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

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

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

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

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

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

c = A("c")
m = B("m")
b = C("b")
n = D("n")
l = E("l")
f = F("f")
h = A("h")
i = D("i")
k = F("k")

c.q = k
m.z = i
m.x = l
m.o = l
m.s = l
m.r = b
m.t = n
b.p = f
b.o = f
n.t = i
n.o = k
n.y = m
l.p = c
l.w = m
f.s = l
f.y = m
f.p = k
f.o = b
h.q = f
i.t = n
i.o = k
i.y = m
k.s = l
k.y = m
k.p = f
k.o = b
assert l.w.r.o.s.p.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

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

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

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

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

c = A("c")
m = B("m")
b = C("b")
n = D("n")
l = E("l")
f = F("f")
h = A("h")
i = D("i")
k = F("k")

c.q = k
m.z = i
m.x = l
m.o = l
m.s = l
m.r = b
m.t = n
b.p = f
b.o = f
n.t = i
n.o = k
n.y = m
l.p = c
l.w = m
f.s = l
f.y = m
f.p = k
f.o = b
h.q = f
i.t = n
i.o = k
i.y = m
k.s = l
k.y = m
k.p = f
k.o = b
assert l.w.r.o.s.p.q.p.txt == "f"