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

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.t: A = None
        self.w: E = None
        self.u: G = None
        self.z: G = None
        self.q: A = None
        self.txt = txt

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

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

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

b = A("b")
c = B("c")
n = C("n")
f = D("f")
k = E("k")
h = F("h")
l = G("l")

b.v = c
c.o = k
c.x = b
n.o = f
n.t = h
f.y = h
f.t = b
f.q = b
f.w = k
f.u = l
f.z = l
k.r = f
k.y = l
h.y = b
l.s = k
l.r = k
l.o = c
l.z = f
assert h.y.v.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.t: A = None
        self.w: E = None
        self.u: G = None
        self.z: G = None
        self.q: A = None
        self.txt = txt

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

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

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

b = A("b")
c = B("c")
n = C("n")
f = D("f")
k = E("k")
h = F("h")
l = G("l")

b.v = c
c.o = k
c.x = b
n.o = f
n.t = h
f.y = h
f.t = b
f.q = b
f.w = k
f.u = l
f.z = l
k.r = f
k.y = l
h.y = b
l.s = k
l.r = k
l.o = c
l.z = f
assert h.y.v.o.r.txt == "f"