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

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

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

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

f = A("f")
h = B("h")
b = C("b")
e = D("e")
k = B("k")
n = C("n")
g = A("g")

f.u = e
f.x = e
f.z = e
f.w = n
h.v = g
h.y = b
b.q = e
b.w = n
b.u = n
e.u = k
e.x = b
e.z = g
k.v = g
k.y = b
n.q = e
n.w = b
n.u = b
g.u = e
g.x = e
g.z = e
g.w = b
assert k.y.u.q.u.v.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: C = None
        self.x: D = None
        self.z: D = None
        self.txt = txt

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

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

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

f = A("f")
h = B("h")
b = C("b")
e = D("e")
k = B("k")
n = C("n")
g = A("g")

f.u = e
f.x = e
f.z = e
f.w = n
h.v = g
h.y = b
b.q = e
b.w = n
b.u = n
e.u = k
e.x = b
e.z = g
k.v = g
k.y = b
n.q = e
n.w = b
n.u = b
g.u = e
g.x = e
g.z = e
g.w = b
assert k.y.u.q.u.v.x.x.txt == "b"