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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: A = None
        self.z: F = None
        self.t: D = None
        self.o: F = None
        self.y: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: D = None
        self.q: F = None
        self.txt = txt

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

a.p = f
a.u = h
a.t = h
a.w = m
a.o = k
b.r = h
b.q = i
b.z = f
b.o = f
b.t = d
b.y = m
h.p = a
h.r = b
h.t = d
d.x = k
d.t = m
k.y = a
f.w = k
f.r = d
f.q = m
i.p = m
i.u = h
i.t = h
i.w = f
i.o = k
m.w = k
m.r = d
m.q = f
assert f.w.y.p.r.t.r.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.u: C = None
        self.w: F = None
        self.o: E = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: A = None
        self.z: F = None
        self.t: D = None
        self.o: F = None
        self.y: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: D = None
        self.q: F = None
        self.txt = txt

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

a.p = f
a.u = h
a.t = h
a.w = m
a.o = k
b.r = h
b.q = i
b.z = f
b.o = f
b.t = d
b.y = m
h.p = a
h.r = b
h.t = d
d.x = k
d.t = m
k.y = a
f.w = k
f.r = d
f.q = m
i.p = m
i.u = h
i.t = h
i.w = f
i.o = k
m.w = k
m.r = d
m.q = f
assert f.w.y.p.r.t.r.t.w.txt == "k"