class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.u: B = None
        self.w: C = None
        self.s: C = None
        self.txt = txt

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

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

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

f = A("f")
n = B("n")
l = C("l")
k = D("k")
c = D("c")
e = C("e")
b = A("b")

f.p = b
f.u = n
f.w = l
f.s = l
n.q = l
l.r = c
l.v = c
l.x = b
l.o = k
k.v = b
k.z = b
c.v = b
c.z = f
e.r = k
e.v = k
e.x = f
e.o = c
b.p = f
b.u = n
b.w = l
b.s = l
assert k.v.u.q.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.u: B = None
        self.w: C = None
        self.s: C = None
        self.txt = txt

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

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

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

f = A("f")
n = B("n")
l = C("l")
k = D("k")
c = D("c")
e = C("e")
b = A("b")

f.p = b
f.u = n
f.w = l
f.s = l
n.q = l
l.r = c
l.v = c
l.x = b
l.o = k
k.v = b
k.z = b
c.v = b
c.z = f
e.r = k
e.v = k
e.x = f
e.o = c
b.p = f
b.u = n
b.w = l
b.s = l
assert k.v.u.q.r.z.txt == "f"