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

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

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

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

l = A("l")
h = B("h")
f = C("f")
i = D("i")
a = A("a")
j = B("j")
b = C("b")

l.w = i
l.t = h
l.v = b
h.r = i
h.z = a
h.p = b
f.w = b
f.v = a
f.p = h
f.r = j
i.t = a
i.q = h
a.w = i
a.t = j
a.v = f
j.r = i
j.z = a
j.p = f
b.w = f
b.v = l
b.p = h
b.r = j
assert b.r.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: B = None
        self.v: C = None
        self.txt = txt

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

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

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

l = A("l")
h = B("h")
f = C("f")
i = D("i")
a = A("a")
j = B("j")
b = C("b")

l.w = i
l.t = h
l.v = b
h.r = i
h.z = a
h.p = b
f.w = b
f.v = a
f.p = h
f.r = j
i.t = a
i.q = h
a.w = i
a.t = j
a.v = f
j.r = i
j.z = a
j.p = f
b.w = f
b.v = l
b.p = h
b.r = j
assert b.r.p.p.txt == "h"