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

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

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

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

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

b.p = n
b.u = n
b.v = l
b.y = f
h.q = l
h.z = e
h.t = j
d.y = j
d.w = j
d.q = h
j.p = d
j.w = l
l.p = f
l.v = b
l.y = j
l.u = n
n.p = d
n.w = l
a.q = l
a.z = e
a.t = f
e.q = l
e.z = h
e.t = n
f.p = d
f.w = b
assert f.w.y.w.y.p.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.v: A = None
        self.y: D = None
        self.u: D = None
        self.txt = txt

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

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

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

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

b.p = n
b.u = n
b.v = l
b.y = f
h.q = l
h.z = e
h.t = j
d.y = j
d.w = j
d.q = h
j.p = d
j.w = l
l.p = f
l.v = b
l.y = j
l.u = n
n.p = d
n.w = l
a.q = l
a.z = e
a.t = f
e.q = l
e.z = h
e.t = n
f.p = d
f.w = b
assert f.w.y.w.y.p.q.q.txt == "l"