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

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

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

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

a = A("a")
l = B("l")
n = C("n")
g = D("g")
m = B("m")
i = D("i")
k = C("k")
j = C("j")
f = C("f")

a.r = i
a.w = f
l.y = n
l.u = m
l.t = k
l.v = a
n.p = l
n.w = m
g.u = k
m.y = n
m.u = l
m.t = j
m.v = a
i.u = k
k.p = l
k.w = m
j.p = m
j.w = l
f.p = l
f.w = m
assert j.p.v.w.p.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: C = None
        self.txt = txt

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

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

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

a = A("a")
l = B("l")
n = C("n")
g = D("g")
m = B("m")
i = D("i")
k = C("k")
j = C("j")
f = C("f")

a.r = i
a.w = f
l.y = n
l.u = m
l.t = k
l.v = a
n.p = l
n.w = m
g.u = k
m.y = n
m.u = l
m.t = j
m.v = a
i.u = k
k.p = l
k.w = m
j.p = m
j.w = l
f.p = l
f.w = m
assert j.p.v.w.p.u.t.txt == "j"