class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: F = None
        self.z: G = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: B = None
        self.txt = txt

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

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

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

b.q = d
b.o = g
b.z = h
b.r = l
i.z = l
i.r = g
j.r = l
j.q = d
l.v = j
d.r = i
d.w = i
g.r = d
g.t = l
g.o = j
g.x = b
h.p = j
h.y = d
h.w = d
h.o = b
h.r = i
assert b.q.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: F = None
        self.z: G = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.r: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: B = None
        self.txt = txt

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

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

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

b.q = d
b.o = g
b.z = h
b.r = l
i.z = l
i.r = g
j.r = l
j.q = d
l.v = j
d.r = i
d.w = i
g.r = d
g.t = l
g.o = j
g.x = b
h.p = j
h.y = d
h.w = d
h.o = b
h.r = i
assert b.q.w.r.txt == "g"