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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: D = None
        self.s: E = None
        self.txt = txt

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

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

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

i = A("i")
h = B("h")
d = C("d")
m = D("m")
f = E("f")
n = B("n")
b = A("b")

i.r = f
i.s = f
i.t = b
h.v = i
h.r = m
h.s = f
d.x = f
d.p = n
m.z = f
m.p = d
m.x = i
f.w = m
n.v = i
n.r = m
n.s = f
b.r = f
b.s = f
b.t = i
assert i.t.s.w.p.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: E = None
        self.t: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: D = None
        self.s: E = None
        self.txt = txt

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

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

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

i = A("i")
h = B("h")
d = C("d")
m = D("m")
f = E("f")
n = B("n")
b = A("b")

i.r = f
i.s = f
i.t = b
h.v = i
h.r = m
h.s = f
d.x = f
d.p = n
m.z = f
m.p = d
m.x = i
f.w = m
n.v = i
n.r = m
n.s = f
b.r = f
b.s = f
b.t = i
assert i.t.s.w.p.p.v.txt == "i"