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

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

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

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

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

f.p = e
f.x = h
f.y = l
n.v = l
n.y = a
h.q = b
h.z = b
h.p = a
i.z = f
i.t = e
i.w = a
i.y = n
l.v = n
l.y = f
b.q = h
b.z = h
b.p = f
m.q = h
m.z = h
m.p = e
e.p = f
e.x = m
e.y = l
a.p = f
a.x = m
a.y = l
k.p = a
k.x = h
k.y = l
assert e.y.v.y.y.y.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

f.p = e
f.x = h
f.y = l
n.v = l
n.y = a
h.q = b
h.z = b
h.p = a
i.z = f
i.t = e
i.w = a
i.y = n
l.v = n
l.y = f
b.q = h
b.z = h
b.p = f
m.q = h
m.z = h
m.p = e
e.p = f
e.x = m
e.y = l
a.p = f
a.x = m
a.y = l
k.p = a
k.x = h
k.y = l
assert e.y.v.y.y.y.p.y.txt == "l"