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

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

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

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

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

i = A("i")
c = B("c")
f = C("f")
n = D("n")
h = E("h")
j = C("j")
b = E("b")
m = C("m")
e = B("e")

i.p = n
i.t = n
i.w = h
i.y = b
c.v = b
f.w = n
f.r = i
f.v = b
n.p = i
n.x = m
h.y = i
j.w = n
j.r = i
j.v = h
b.y = i
m.w = n
m.r = i
m.v = b
e.v = h
assert i.t.x.v.y.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: E = None
        self.t: D = None
        self.y: E = None
        self.txt = txt

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

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

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

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

i = A("i")
c = B("c")
f = C("f")
n = D("n")
h = E("h")
j = C("j")
b = E("b")
m = C("m")
e = B("e")

i.p = n
i.t = n
i.w = h
i.y = b
c.v = b
f.w = n
f.r = i
f.v = b
n.p = i
n.x = m
h.y = i
j.w = n
j.r = i
j.v = h
b.y = i
m.w = n
m.r = i
m.v = b
e.v = h
assert i.t.x.v.y.w.y.txt == "i"