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

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

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

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

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

d = A("d")
j = B("j")
i = C("i")
e = D("e")
f = E("f")
g = A("g")
a = A("a")
n = A("n")
k = A("k")
c = C("c")

d.o = f
d.y = e
j.v = d
i.w = c
i.z = f
i.p = f
i.y = e
e.r = i
e.o = i
f.o = j
g.o = f
g.y = e
a.o = f
a.y = e
n.o = f
n.y = e
k.o = f
k.y = e
c.w = i
c.z = f
c.p = f
c.y = e
assert k.y.o.p.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.y: D = None
        self.txt = txt

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

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

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

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

d = A("d")
j = B("j")
i = C("i")
e = D("e")
f = E("f")
g = A("g")
a = A("a")
n = A("n")
k = A("k")
c = C("c")

d.o = f
d.y = e
j.v = d
i.w = c
i.z = f
i.p = f
i.y = e
e.r = i
e.o = i
f.o = j
g.o = f
g.y = e
a.o = f
a.y = e
n.o = f
n.y = e
k.o = f
k.y = e
c.w = i
c.z = f
c.p = f
c.y = e
assert k.y.o.p.o.v.txt == "d"