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

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

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

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

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

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

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

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

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

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

a.v = d
a.z = d
a.o = f
a.u = c
f.y = c
f.x = c
f.r = j
f.w = n
n.o = k
n.r = c
k.w = j
k.p = n
c.y = f
c.x = f
c.r = k
c.w = n
d.w = k
d.p = n
b.w = d
b.p = n
j.w = d
j.p = n
assert f.w.r.r.p.r.w.r.y.txt == "f"