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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

b.u = c
b.x = c
m.z = c
m.u = h
m.t = a
m.o = b
n.w = m
n.r = b
n.z = b
n.q = a
h.u = a
h.p = a
h.o = d
h.w = d
h.y = d
h.x = d
c.q = b
c.p = a
c.o = d
c.w = f
d.w = b
d.t = m
k.t = d
k.y = f
k.u = b
k.r = a
k.o = m
a.u = h
a.p = h
a.o = d
a.w = d
a.y = d
a.x = d
f.t = d
f.y = k
f.u = b
f.r = h
f.o = m
assert d.w.u.p.txt == "a"