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

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

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

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

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

k.p = d
k.z = i
k.y = b
k.o = b
j.v = b
j.s = i
e.v = i
e.x = c
d.p = b
c.p = d
c.y = d
c.o = d
c.z = j
i.v = b
i.s = j
a.p = b
a.y = b
a.z = i
a.o = d
b.p = d
assert e.x.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: B = None
        self.y: D = None
        self.o: D = None
        self.txt = txt

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

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

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

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

k.p = d
k.z = i
k.y = b
k.o = b
j.v = b
j.s = i
e.v = i
e.x = c
d.p = b
c.p = d
c.y = d
c.o = d
c.z = j
i.v = b
i.s = j
a.p = b
a.y = b
a.z = i
a.o = d
b.p = d
assert e.x.y.p.txt == "b"