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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: D = None
        self.y: A = None
        self.r: B = None
        self.v: E = None
        self.q: E = None
        self.s: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: C = None
        self.y: F = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: D = None
        self.y: A = None
        self.r: B = None
        self.v: E = None
        self.q: E = None
        self.s: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: C = None
        self.y: F = None
        self.t: C = None
        self.txt = txt

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

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