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

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.y: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: C = None
        self.q: B = None
        self.txt = txt

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

f = A("f")
h = B("h")
d = C("d")
j = D("j")
b = E("b")
i = B("i")
a = B("a")

f.y = a
f.v = a
f.p = b
f.o = b
f.q = d
h.o = i
h.s = i
h.y = a
d.w = f
d.u = h
j.u = d
j.z = d
j.q = h
b.p = i
i.o = a
i.s = a
i.y = a
a.o = i
a.y = i
a.s = h
assert b.p.o.o.s.s.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: E = None
        self.q: C = None
        self.v: B = None
        self.o: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.y: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: C = None
        self.q: B = None
        self.txt = txt

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

f = A("f")
h = B("h")
d = C("d")
j = D("j")
b = E("b")
i = B("i")
a = B("a")

f.y = a
f.v = a
f.p = b
f.o = b
f.q = d
h.o = i
h.s = i
h.y = a
d.w = f
d.u = h
j.u = d
j.z = d
j.q = h
b.p = i
i.o = a
i.s = a
i.y = a
a.o = i
a.y = i
a.s = h
assert b.p.o.o.s.s.y.o.txt == "i"