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

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

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

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

f = A("f")
e = B("e")
b = C("b")
c = D("c")
i = B("i")
l = D("l")
n = C("n")

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

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

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

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

f = A("f")
e = B("e")
b = C("b")
c = D("c")
i = B("i")
l = D("l")
n = C("n")

f.u = b
f.v = e
e.t = c
e.w = f
e.y = f
e.x = l
b.x = f
b.q = f
b.z = f
b.y = e
c.z = b
i.t = c
i.x = c
i.w = f
i.y = f
l.z = b
n.x = f
n.q = f
n.z = f
n.y = e
assert f.u.q.u.y.t.z.txt == "b"