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

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

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

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

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

i = A("i")
j = B("j")
k = C("k")
c = D("c")
d = E("d")
m = C("m")
f = A("f")

i.p = d
i.x = k
i.u = j
j.o = f
j.y = m
j.u = k
j.x = c
k.r = m
k.o = m
k.q = f
k.w = c
k.x = j
c.p = j
c.q = j
c.w = d
c.y = i
c.o = i
d.y = c
m.r = k
m.o = k
m.q = i
m.w = c
m.x = j
f.p = d
f.x = k
f.u = j
assert d.y.w.y.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: C = None
        self.u: B = None
        self.txt = txt

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

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

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

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

i = A("i")
j = B("j")
k = C("k")
c = D("c")
d = E("d")
m = C("m")
f = A("f")

i.p = d
i.x = k
i.u = j
j.o = f
j.y = m
j.u = k
j.x = c
k.r = m
k.o = m
k.q = f
k.w = c
k.x = j
c.p = j
c.q = j
c.w = d
c.y = i
c.o = i
d.y = c
m.r = k
m.o = k
m.q = i
m.w = c
m.x = j
f.p = d
f.x = k
f.u = j
assert d.y.w.y.p.o.txt == "f"