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

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

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

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

e = A("e")
k = B("k")
i = C("i")
f = D("f")
d = B("d")
c = D("c")
b = B("b")

e.o = i
e.r = c
k.v = i
i.w = e
i.v = c
f.p = i
f.w = i
f.y = c
f.v = c
d.v = i
c.p = i
c.w = i
c.y = f
c.v = f
b.v = i
assert b.v.v.p.w.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: D = None
        self.txt = txt

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

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

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

e = A("e")
k = B("k")
i = C("i")
f = D("f")
d = B("d")
c = D("c")
b = B("b")

e.o = i
e.r = c
k.v = i
i.w = e
i.v = c
f.p = i
f.w = i
f.y = c
f.v = c
d.v = i
c.p = i
c.w = i
c.y = f
c.v = f
b.v = i
assert b.v.v.p.w.r.p.txt == "i"