class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.o: B = None
        self.v: E = None
        self.q: E = None
        self.x: C = None
        self.w: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: G = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: B = None
        self.r: B = None
        self.v: B = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

k.r = m
k.w = m
k.o = e
k.v = j
k.q = j
k.x = b
e.r = c
e.z = m
e.w = b
b.o = e
c.x = e
c.z = m
c.s = b
j.t = c
j.z = c
j.s = e
j.r = e
j.v = e
h.q = m
m.y = c
assert b.o.z.y.z.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.o: B = None
        self.v: E = None
        self.q: E = None
        self.x: C = None
        self.w: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: G = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: B = None
        self.r: B = None
        self.v: B = None
        self.z: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

k.r = m
k.w = m
k.o = e
k.v = j
k.q = j
k.x = b
e.r = c
e.z = m
e.w = b
b.o = e
c.x = e
c.z = m
c.s = b
j.t = c
j.z = c
j.s = e
j.r = e
j.v = e
h.q = m
m.y = c
assert b.o.z.y.z.y.z.txt == "m"