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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: G = None
        self.v: D = None
        self.r: D = None
        self.txt = txt

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

d = A("d")
j = B("j")
c = C("c")
f = D("f")
l = E("l")
g = F("g")
i = G("i")

d.y = j
d.p = j
d.u = j
d.x = c
d.o = f
d.r = f
d.q = g
j.s = c
c.q = l
c.v = g
c.x = d
c.w = f
c.r = j
f.z = l
l.q = c
g.o = j
g.t = i
g.v = f
g.r = f
i.x = l
assert l.q.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: C = None
        self.o: D = None
        self.p: B = None
        self.q: F = None
        self.r: D = None
        self.u: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: G = None
        self.v: D = None
        self.r: D = None
        self.txt = txt

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

d = A("d")
j = B("j")
c = C("c")
f = D("f")
l = E("l")
g = F("g")
i = G("i")

d.y = j
d.p = j
d.u = j
d.x = c
d.o = f
d.r = f
d.q = g
j.s = c
c.q = l
c.v = g
c.x = d
c.w = f
c.r = j
f.z = l
l.q = c
g.o = j
g.t = i
g.v = f
g.r = f
i.x = l
assert l.q.v.v.txt == "f"