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

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

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

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

c = A("c")
k = B("k")
e = C("e")
a = D("a")
j = B("j")
g = A("g")

c.z = a
k.z = a
e.v = a
e.s = a
e.r = j
e.w = j
a.u = j
a.s = c
a.x = g
j.z = a
g.z = a
assert e.v.x.z.x.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

c = A("c")
k = B("k")
e = C("e")
a = D("a")
j = B("j")
g = A("g")

c.z = a
k.z = a
e.v = a
e.s = a
e.r = j
e.w = j
a.u = j
a.s = c
a.x = g
j.z = a
g.z = a
assert e.v.x.z.x.z.s.txt == "c"