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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: E = None
        self.u: F = None
        self.z: B = None
        self.o: B = None
        self.w: G = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.y: D = None
        self.o: D = None
        self.v: A = None
        self.p: B = None
        self.txt = txt

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

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

k = A("k")
d = B("d")
g = C("g")
l = D("l")
j = E("j")
m = F("m")
b = G("b")
i = G("i")

k.r = d
d.z = j
d.x = k
g.z = j
g.p = l
g.q = k
g.r = k
l.q = g
l.y = j
l.s = j
l.u = m
l.z = d
l.o = d
l.w = i
j.x = b
j.y = l
j.o = l
j.v = k
j.p = d
m.o = g
m.w = d
m.q = d
b.w = k
i.w = k
assert l.s.x.w.r.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: E = None
        self.u: F = None
        self.z: B = None
        self.o: B = None
        self.w: G = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.y: D = None
        self.o: D = None
        self.v: A = None
        self.p: B = None
        self.txt = txt

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

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

k = A("k")
d = B("d")
g = C("g")
l = D("l")
j = E("j")
m = F("m")
b = G("b")
i = G("i")

k.r = d
d.z = j
d.x = k
g.z = j
g.p = l
g.q = k
g.r = k
l.q = g
l.y = j
l.s = j
l.u = m
l.z = d
l.o = d
l.w = i
j.x = b
j.y = l
j.o = l
j.v = k
j.p = d
m.o = g
m.w = d
m.q = d
b.w = k
i.w = k
assert l.s.x.w.r.x.r.txt == "d"