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

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

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

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

a = A("a")
k = B("k")
e = C("e")
f = D("f")
l = A("l")
g = B("g")
m = A("m")
j = C("j")

a.z = e
a.w = k
a.t = f
k.r = g
k.u = g
k.x = e
e.q = k
e.t = f
e.w = m
f.o = l
f.p = a
l.z = e
l.w = k
l.t = f
g.r = k
g.u = k
g.x = e
m.z = j
m.w = k
m.t = f
j.q = k
j.t = f
j.w = m
assert e.w.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.w: B = None
        self.t: D = None
        self.txt = txt

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

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

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

a = A("a")
k = B("k")
e = C("e")
f = D("f")
l = A("l")
g = B("g")
m = A("m")
j = C("j")

a.z = e
a.w = k
a.t = f
k.r = g
k.u = g
k.x = e
e.q = k
e.t = f
e.w = m
f.o = l
f.p = a
l.z = e
l.w = k
l.t = f
g.r = k
g.u = k
g.x = e
m.z = j
m.w = k
m.t = f
j.q = k
j.t = f
j.w = m
assert e.w.t.p.txt == "a"