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

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: A = None
        self.u: B = None
        self.txt = txt

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

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

f = A("f")
m = B("m")
b = C("b")
e = D("e")
j = D("j")
k = B("k")
l = C("l")
c = D("c")
h = A("h")

f.y = h
f.v = c
f.s = j
f.u = b
m.s = k
m.u = k
m.x = f
b.r = l
b.u = h
b.p = k
b.y = k
e.w = m
e.p = l
e.t = b
j.w = m
j.p = b
j.t = l
k.s = m
k.u = m
k.x = f
l.r = b
l.u = f
l.p = k
l.y = k
c.w = m
c.p = l
c.t = b
h.y = f
h.v = e
h.s = e
h.u = b
assert b.r.u.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: D = None
        self.s: D = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: A = None
        self.u: B = None
        self.txt = txt

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

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

f = A("f")
m = B("m")
b = C("b")
e = D("e")
j = D("j")
k = B("k")
l = C("l")
c = D("c")
h = A("h")

f.y = h
f.v = c
f.s = j
f.u = b
m.s = k
m.u = k
m.x = f
b.r = l
b.u = h
b.p = k
b.y = k
e.w = m
e.p = l
e.t = b
j.w = m
j.p = b
j.t = l
k.s = m
k.u = m
k.x = f
l.r = b
l.u = f
l.p = k
l.y = k
c.w = m
c.p = l
c.t = b
h.y = f
h.v = e
h.s = e
h.u = b
assert b.r.u.y.u.y.txt == "k"