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

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

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

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

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

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

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

h.t = i
h.q = j
h.w = k
j.u = i
j.y = m
e.r = n
e.y = n
d.v = k
d.y = n
n.t = h
n.p = h
i.y = j
i.w = k
i.o = h
m.v = k
m.y = k
k.t = h
k.p = h
assert i.w.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.q: B = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

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

h.t = i
h.q = j
h.w = k
j.u = i
j.y = m
e.r = n
e.y = n
d.v = k
d.y = n
n.t = h
n.p = h
i.y = j
i.w = k
i.o = h
m.v = k
m.y = k
k.t = h
k.p = h
assert i.w.p.w.txt == "k"