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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: D = None
        self.z: E = None
        self.txt = txt

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

f.v = m
f.y = h
c.u = h
c.y = j
c.p = j
c.o = i
i.w = m
i.y = f
i.z = c
h.o = i
h.w = f
b.o = f
b.p = c
b.y = c
b.u = m
b.w = j
b.r = h
j.y = c
m.x = f
m.u = h
m.z = b
assert c.o.w.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: G = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: D = None
        self.z: E = None
        self.txt = txt

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

f.v = m
f.y = h
c.u = h
c.y = j
c.p = j
c.o = i
i.w = m
i.y = f
i.z = c
h.o = i
h.w = f
b.o = f
b.p = c
b.y = c
b.u = m
b.w = j
b.r = h
j.y = c
m.x = f
m.u = h
m.z = b
assert c.o.w.z.r.txt == "h"