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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = 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: B = None
        self.r: D = None
        self.s: A = None
        self.txt = txt

h = A("h")
b = B("b")
d = C("d")
n = D("n")
c = E("c")
f = F("f")
m = C("m")
i = F("i")
j = E("j")
e = B("e")

h.x = f
h.q = n
b.z = c
d.p = c
d.v = n
d.u = h
d.o = h
d.w = f
n.q = c
c.q = f
f.u = b
f.r = n
f.s = h
m.p = c
m.v = n
m.u = h
m.o = h
m.w = i
i.u = e
i.r = n
i.s = h
j.q = i
e.z = c
assert b.z.q.r.q.q.s.x.u.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = 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: B = None
        self.r: D = None
        self.s: A = None
        self.txt = txt

h = A("h")
b = B("b")
d = C("d")
n = D("n")
c = E("c")
f = F("f")
m = C("m")
i = F("i")
j = E("j")
e = B("e")

h.x = f
h.q = n
b.z = c
d.p = c
d.v = n
d.u = h
d.o = h
d.w = f
n.q = c
c.q = f
f.u = b
f.r = n
f.s = h
m.p = c
m.v = n
m.u = h
m.o = h
m.w = i
i.u = e
i.r = n
i.s = h
j.q = i
e.z = c
assert b.z.q.r.q.q.s.x.u.z.q.txt == "f"