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

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

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

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

f = A("f")
h = B("h")
e = C("e")
i = D("i")
n = C("n")
j = A("j")
c = D("c")

f.y = i
f.u = n
f.v = h
h.p = c
e.t = j
e.s = n
e.q = f
e.w = h
i.w = j
i.r = j
i.v = h
i.p = e
n.t = j
n.s = e
n.q = f
n.w = h
j.y = c
j.u = n
j.v = h
c.w = j
c.r = j
c.v = h
c.p = e
assert n.w.p.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: C = None
        self.v: B = None
        self.txt = txt

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

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

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

f = A("f")
h = B("h")
e = C("e")
i = D("i")
n = C("n")
j = A("j")
c = D("c")

f.y = i
f.u = n
f.v = h
h.p = c
e.t = j
e.s = n
e.q = f
e.w = h
i.w = j
i.r = j
i.v = h
i.p = e
n.t = j
n.s = e
n.q = f
n.w = h
j.y = c
j.u = n
j.v = h
c.w = j
c.r = j
c.v = h
c.p = e
assert n.w.p.v.p.txt == "c"