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

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

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

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

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

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

j = A("j")
e = B("e")
g = C("g")
f = D("f")
i = E("i")
m = F("m")
h = F("h")
c = C("c")
l = D("l")
k = B("k")

j.v = e
j.r = c
e.s = m
g.w = c
g.v = c
g.q = e
g.p = j
f.q = i
i.p = g
m.z = j
h.z = j
c.w = g
c.v = g
c.q = e
c.p = j
l.q = i
k.s = m
assert f.q.p.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

j = A("j")
e = B("e")
g = C("g")
f = D("f")
i = E("i")
m = F("m")
h = F("h")
c = C("c")
l = D("l")
k = B("k")

j.v = e
j.r = c
e.s = m
g.w = c
g.v = c
g.q = e
g.p = j
f.q = i
i.p = g
m.z = j
h.z = j
c.w = g
c.v = g
c.q = e
c.p = j
l.q = i
k.s = m
assert f.q.p.w.v.txt == "g"