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

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

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

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.o: G = None
        self.q: F = None
        self.z: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: D = None
        self.o: F = None
        self.q: D = None
        self.txt = txt

d = A("d")
l = B("l")
f = C("f")
h = D("h")
i = E("i")
e = F("e")
m = G("m")
c = D("c")

d.w = m
l.z = d
l.o = d
l.s = f
f.v = m
f.q = m
f.p = m
h.p = m
h.o = m
h.q = e
h.z = f
i.r = f
e.p = l
m.w = i
m.p = c
m.o = e
m.q = h
c.p = m
c.o = m
c.q = e
c.z = f
assert l.z.w.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.o: G = None
        self.q: F = None
        self.z: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: D = None
        self.o: F = None
        self.q: D = None
        self.txt = txt

d = A("d")
l = B("l")
f = C("f")
h = D("h")
i = E("i")
e = F("e")
m = G("m")
c = D("c")

d.w = m
l.z = d
l.o = d
l.s = f
f.v = m
f.q = m
f.p = m
h.p = m
h.o = m
h.q = e
h.z = f
i.r = f
e.p = l
m.w = i
m.p = c
m.o = e
m.q = h
c.p = m
c.o = m
c.q = e
c.z = f
assert l.z.w.w.r.txt == "f"