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

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: A = None
        self.p: A = None
        self.y: A = None
        self.txt = txt

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

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

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

k.y = g
k.s = g
k.u = n
i.q = g
i.t = k
i.p = k
i.y = k
d.v = f
b.v = n
b.u = f
b.r = l
n.v = b
n.u = f
n.r = d
f.v = b
f.u = b
f.r = d
a.q = i
a.t = k
a.p = k
a.y = k
g.q = a
g.t = k
g.p = k
g.y = k
l.v = f
m.v = f
assert k.y.y.y.t.u.v.v.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: B = None
        self.u: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: A = None
        self.p: A = None
        self.y: A = None
        self.txt = txt

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

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

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

k.y = g
k.s = g
k.u = n
i.q = g
i.t = k
i.p = k
i.y = k
d.v = f
b.v = n
b.u = f
b.r = l
n.v = b
n.u = f
n.r = d
f.v = b
f.u = b
f.r = d
a.q = i
a.t = k
a.p = k
a.y = k
g.q = a
g.t = k
g.p = k
g.y = k
l.v = f
m.v = f
assert k.y.y.y.t.u.v.v.v.u.txt == "f"