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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.y: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: E = None
        self.u: D = None
        self.p: B = None
        self.txt = txt

f = A("f")
b = B("b")
a = C("a")
m = D("m")
l = E("l")
h = F("h")
g = G("g")

f.w = m
f.v = m
b.x = m
b.r = a
b.o = f
a.z = m
a.u = g
a.v = b
m.y = b
l.u = h
l.y = m
h.p = f
h.x = b
g.s = l
g.x = l
g.u = m
g.p = b
assert h.x.x.y.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.y: D = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: E = None
        self.u: D = None
        self.p: B = None
        self.txt = txt

f = A("f")
b = B("b")
a = C("a")
m = D("m")
l = E("l")
h = F("h")
g = G("g")

f.w = m
f.v = m
b.x = m
b.r = a
b.o = f
a.z = m
a.u = g
a.v = b
m.y = b
l.u = h
l.y = m
h.p = f
h.x = b
g.s = l
g.x = l
g.u = m
g.p = b
assert h.x.x.y.r.u.txt == "g"