class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

i.u = h
i.x = b
f.o = h
f.r = k
k.t = c
k.p = b
h.w = f
h.p = f
h.t = f
c.o = i
c.r = i
c.p = f
c.w = f
b.u = h
b.x = i
n.t = c
n.p = b
assert h.w.o.t.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

i.u = h
i.x = b
f.o = h
f.r = k
k.t = c
k.p = b
h.w = f
h.p = f
h.t = f
c.o = i
c.r = i
c.p = f
c.w = f
b.u = h
b.x = i
n.t = c
n.p = b
assert h.w.o.t.r.p.txt == "b"