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

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

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

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

h = A("h")
f = B("f")
b = C("b")
m = D("m")
j = A("j")
l = B("l")
a = C("a")
g = D("g")
n = B("n")
e = C("e")

h.w = e
h.s = e
h.t = b
f.v = g
b.y = j
b.v = f
b.p = m
m.t = n
j.w = a
j.t = e
j.s = e
l.v = g
a.y = j
a.v = n
a.p = m
g.t = f
n.v = g
e.y = h
e.v = n
e.p = g
assert f.v.t.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: C = None
        self.s: C = None
        self.txt = txt

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

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

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

h = A("h")
f = B("f")
b = C("b")
m = D("m")
j = A("j")
l = B("l")
a = C("a")
g = D("g")
n = B("n")
e = C("e")

h.w = e
h.s = e
h.t = b
f.v = g
b.y = j
b.v = f
b.p = m
m.t = n
j.w = a
j.t = e
j.s = e
l.v = g
a.y = j
a.v = n
a.p = m
g.t = f
n.v = g
e.y = h
e.v = n
e.p = g
assert f.v.t.v.t.txt == "f"