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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: A = None
        self.r: E = None
        self.o: D = None
        self.x: E = None
        self.v: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

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

g.w = e
g.r = l
g.q = m
d.r = i
c.s = g
c.p = g
c.r = l
c.x = l
c.o = m
c.v = i
m.w = i
l.z = e
l.x = m
l.r = i
i.w = d
e.s = g
e.p = g
e.r = l
e.x = l
e.o = m
e.v = i
assert g.w.x.z.o.w.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: E = None
        self.q: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: A = None
        self.r: E = None
        self.o: D = None
        self.x: E = None
        self.v: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

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

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