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

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

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

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

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

d.p = f
k.x = e
e.v = c
e.z = j
e.w = f
b.v = e
b.x = e
b.u = e
f.v = e
f.x = e
f.u = e
i.p = f
n.v = e
n.x = e
n.u = e
c.x = e
j.x = e
assert i.p.v.z.x.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

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

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

d.p = f
k.x = e
e.v = c
e.z = j
e.w = f
b.v = e
b.x = e
b.u = e
f.v = e
f.x = e
f.u = e
i.p = f
n.v = e
n.x = e
n.u = e
c.x = e
j.x = e
assert i.p.v.z.x.z.x.txt == "e"