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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: D = 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.w: E = None
        self.y: C = None
        self.txt = txt

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

d.r = b
d.v = b
n.w = j
n.t = j
n.x = m
n.r = m
h.o = m
h.q = m
h.s = l
h.t = l
h.y = n
h.w = b
h.p = d
l.q = n
m.v = h
m.u = l
j.y = d
b.w = m
b.y = h
assert b.y.t.q.w.y.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.v: G = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: D = 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.w: E = None
        self.y: C = None
        self.txt = txt

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

d.r = b
d.v = b
n.w = j
n.t = j
n.x = m
n.r = m
h.o = m
h.q = m
h.s = l
h.t = l
h.y = n
h.w = b
h.p = d
l.q = n
m.v = h
m.u = l
j.y = d
b.w = m
b.y = h
assert b.y.t.q.w.y.v.w.txt == "m"