class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: D = None
        self.x: G = None
        self.s: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: F = None
        self.o: A = None
        self.y: C = None
        self.v: E = None
        self.t: D = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: G = None
        self.y: D = None
        self.p: F = None
        self.w: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: A = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: F = None
        self.o: A = None
        self.y: C = None
        self.v: E = None
        self.t: D = None
        self.s: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: G = None
        self.y: D = None
        self.p: F = None
        self.w: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.o: A = None
        self.txt = txt

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

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

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