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

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

f.u = d
f.y = d
f.v = k
f.z = g
l.x = d
a.z = i
a.y = f
a.p = g
b.v = n
b.r = k
c.z = i
c.y = f
c.p = k
k.u = d
k.y = l
k.v = g
k.z = g
d.x = l
i.z = a
i.y = k
i.p = k
g.u = d
g.y = l
g.v = k
g.z = f
n.v = b
n.r = g
assert b.v.v.r.u.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: B = None
        self.v: A = None
        self.z: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

f.u = d
f.y = d
f.v = k
f.z = g
l.x = d
a.z = i
a.y = f
a.p = g
b.v = n
b.r = k
c.z = i
c.y = f
c.p = k
k.u = d
k.y = l
k.v = g
k.z = g
d.x = l
i.z = a
i.y = k
i.p = k
g.u = d
g.y = l
g.v = k
g.z = f
n.v = b
n.r = g
assert b.v.v.r.u.x.x.txt == "d"