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

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

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

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

b = A("b")
m = B("m")
d = C("d")
k = D("k")
l = C("l")
a = C("a")
f = A("f")

b.r = m
b.y = m
b.x = k
m.z = d
m.t = f
m.x = k
m.y = a
d.o = k
d.y = k
d.w = k
d.v = a
k.p = b
k.o = b
k.y = m
k.z = d
l.o = k
l.y = k
l.w = k
l.v = d
a.o = k
a.y = k
a.w = k
a.v = l
f.r = m
f.y = m
f.x = k
assert k.p.r.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: B = None
        self.x: D = None
        self.txt = txt

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

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

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

b = A("b")
m = B("m")
d = C("d")
k = D("k")
l = C("l")
a = C("a")
f = A("f")

b.r = m
b.y = m
b.x = k
m.z = d
m.t = f
m.x = k
m.y = a
d.o = k
d.y = k
d.w = k
d.v = a
k.p = b
k.o = b
k.y = m
k.z = d
l.o = k
l.y = k
l.w = k
l.v = d
a.o = k
a.y = k
a.w = k
a.v = l
f.r = m
f.y = m
f.x = k
assert k.p.r.z.v.txt == "a"