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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: F = None
        self.z: E = None
        self.w: F = None
        self.x: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: C = None
        self.q: B = None
        self.t: G = None
        self.y: D = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: F = None
        self.z: E = None
        self.w: F = None
        self.x: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: C = None
        self.q: B = None
        self.t: G = None
        self.y: D = None
        self.p: B = None
        self.txt = txt

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

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

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

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