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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.o: C = None
        self.u: B = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.o: C = None
        self.u: B = None
        self.txt = txt

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

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