class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: D = None
        self.p: D = None
        self.r: A = None
        self.u: F = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

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

d = A("d")
a = B("a")
c = C("c")
i = D("i")
h = E("h")
n = F("n")
l = G("l")
m = A("m")

d.v = n
d.u = n
d.w = i
d.p = i
d.r = m
d.o = c
a.p = h
c.w = d
c.y = i
c.v = l
i.w = n
i.x = l
i.q = a
h.q = n
n.u = d
n.o = d
n.r = a
n.z = a
l.z = m
l.y = m
l.w = d
l.v = a
l.o = c
l.r = i
m.v = n
m.u = n
m.w = i
m.p = i
m.r = d
m.o = c
assert h.q.z.p.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: D = None
        self.p: D = None
        self.r: A = None
        self.u: F = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

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

d = A("d")
a = B("a")
c = C("c")
i = D("i")
h = E("h")
n = F("n")
l = G("l")
m = A("m")

d.v = n
d.u = n
d.w = i
d.p = i
d.r = m
d.o = c
a.p = h
c.w = d
c.y = i
c.v = l
i.w = n
i.x = l
i.q = a
h.q = n
n.u = d
n.o = d
n.r = a
n.z = a
l.z = m
l.y = m
l.w = d
l.v = a
l.o = c
l.r = i
m.v = n
m.u = n
m.w = i
m.p = i
m.r = d
m.o = c
assert h.q.z.p.q.o.txt == "d"