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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: B = None
        self.o: B = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.z: E = None
        self.q: C = None
        self.w: B = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: B = None
        self.o: B = None
        self.t: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.z: E = None
        self.q: C = None
        self.w: B = None
        self.u: F = None
        self.txt = txt

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

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

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

k.p = h
k.w = l
b.t = l
b.y = l
b.w = l
b.u = m
h.v = k
h.q = b
h.o = b
h.t = i
m.y = l
m.u = l
m.z = i
m.q = h
m.w = b
i.o = h
i.t = h
i.r = k
i.y = k
l.t = k
l.s = m
assert l.s.q.v.w.t.p.txt == "h"