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

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

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

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

d = A("d")
b = B("b")
f = C("f")
k = D("k")
l = B("l")
m = C("m")
g = A("g")
i = D("i")
n = B("n")

d.u = g
b.y = d
b.o = f
b.s = f
b.t = g
f.z = m
f.w = n
k.s = l
k.r = i
k.v = f
k.u = g
l.y = d
l.t = d
l.o = f
l.s = m
m.z = f
m.w = b
g.u = d
i.s = l
i.r = k
i.v = f
i.u = d
n.y = g
n.t = g
n.o = f
n.s = f
assert k.v.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

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

d = A("d")
b = B("b")
f = C("f")
k = D("k")
l = B("l")
m = C("m")
g = A("g")
i = D("i")
n = B("n")

d.u = g
b.y = d
b.o = f
b.s = f
b.t = g
f.z = m
f.w = n
k.s = l
k.r = i
k.v = f
k.u = g
l.y = d
l.t = d
l.o = f
l.s = m
m.z = f
m.w = b
g.u = d
i.s = l
i.r = k
i.v = f
i.u = d
n.y = g
n.t = g
n.o = f
n.s = f
assert k.v.z.z.txt == "f"