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

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

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

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

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

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

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

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

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

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

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

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

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

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

d.t = h
k.p = m
k.u = n
k.w = l
m.p = d
m.t = d
m.y = k
m.o = b
m.r = l
l.r = h
b.o = h
b.w = h
b.u = l
b.y = n
b.q = m
b.p = k
h.w = k
n.o = h
n.w = h
n.u = l
n.y = b
n.q = m
n.p = k
assert b.o.w.w.r.w.txt == "k"