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

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

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

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

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

f = A("f")
g = B("g")
c = C("c")
h = D("h")
i = E("i")
j = A("j")
d = B("d")
l = E("l")
k = B("k")

f.q = h
f.r = c
f.u = j
g.u = d
g.t = j
g.v = c
g.r = f
c.z = f
c.u = g
h.o = f
i.v = h
j.q = h
j.r = c
j.u = f
d.u = g
d.t = f
d.r = f
d.v = c
l.v = h
k.u = g
k.t = f
k.r = f
k.v = c
assert l.v.o.q.o.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.r: C = None
        self.u: A = None
        self.txt = txt

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

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

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

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

f = A("f")
g = B("g")
c = C("c")
h = D("h")
i = E("i")
j = A("j")
d = B("d")
l = E("l")
k = B("k")

f.q = h
f.r = c
f.u = j
g.u = d
g.t = j
g.v = c
g.r = f
c.z = f
c.u = g
h.o = f
i.v = h
j.q = h
j.r = c
j.u = f
d.u = g
d.t = f
d.r = f
d.v = c
l.v = h
k.u = g
k.t = f
k.r = f
k.v = c
assert l.v.o.q.o.u.u.txt == "f"