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

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

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

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

l = A("l")
f = B("f")
e = C("e")
n = D("n")
g = B("g")
c = C("c")
a = D("a")

l.u = c
l.y = f
l.v = g
f.v = n
f.t = g
e.z = l
n.x = c
n.t = c
n.u = f
n.w = a
g.v = a
g.t = f
c.z = l
a.x = e
a.t = e
a.u = g
a.w = n
assert l.y.t.t.v.w.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: B = None
        self.v: B = None
        self.txt = txt

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

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

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

l = A("l")
f = B("f")
e = C("e")
n = D("n")
g = B("g")
c = C("c")
a = D("a")

l.u = c
l.y = f
l.v = g
f.v = n
f.t = g
e.z = l
n.x = c
n.t = c
n.u = f
n.w = a
g.v = a
g.t = f
c.z = l
a.x = e
a.t = e
a.u = g
a.w = n
assert l.y.t.t.v.w.w.u.txt == "f"