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

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

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

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

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

f.v = k
f.z = b
f.t = j
j.w = f
j.z = k
j.p = k
j.v = c
m.s = n
m.r = e
n.t = f
c.v = m
c.z = k
c.t = j
e.t = f
b.s = e
b.r = n
k.s = n
k.r = e
assert c.v.s.t.v.s.t.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: C = None
        self.t: B = None
        self.txt = txt

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

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

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

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

f.v = k
f.z = b
f.t = j
j.w = f
j.z = k
j.p = k
j.v = c
m.s = n
m.r = e
n.t = f
c.v = m
c.z = k
c.t = j
e.t = f
b.s = e
b.r = n
k.s = n
k.r = e
assert c.v.s.t.v.s.t.t.w.txt == "f"