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

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.z: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: C = None
        self.q: F = None
        self.r: F = None
        self.txt = txt

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

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

j = A("j")
g = B("g")
l = C("l")
a = D("a")
f = E("f")
k = F("k")
h = G("h")
b = E("b")

j.r = a
g.w = l
l.y = h
l.s = b
a.o = g
a.v = g
a.z = h
f.u = k
f.q = k
f.r = k
f.x = l
k.r = g
h.v = l
h.s = l
b.u = k
b.q = k
b.r = k
b.x = l
assert k.r.w.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.z: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: C = None
        self.q: F = None
        self.r: F = None
        self.txt = txt

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

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

j = A("j")
g = B("g")
l = C("l")
a = D("a")
f = E("f")
k = F("k")
h = G("h")
b = E("b")

j.r = a
g.w = l
l.y = h
l.s = b
a.o = g
a.v = g
a.z = h
f.u = k
f.q = k
f.r = k
f.x = l
k.r = g
h.v = l
h.s = l
b.u = k
b.q = k
b.r = k
b.x = l
assert k.r.w.y.v.txt == "l"