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

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.t: C = None
        self.p: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.r: F = None
        self.z: G = None
        self.w: B = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: B = None
        self.y: E = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

d = A("d")
n = B("n")
f = C("f")
e = D("e")
j = E("j")
g = F("g")
m = G("m")
l = D("l")
c = E("c")
a = A("a")

d.p = g
n.o = g
n.p = g
n.t = f
f.p = m
f.z = m
f.r = g
f.w = n
f.v = l
e.y = f
j.q = l
j.t = n
j.y = c
g.v = n
g.t = c
g.u = m
m.s = f
l.y = f
c.q = l
c.t = n
c.y = j
a.p = g
assert e.y.v.y.r.v.o.t.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: F = None
        self.t: C = None
        self.p: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: G = None
        self.r: F = None
        self.z: G = None
        self.w: B = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: B = None
        self.y: E = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

d = A("d")
n = B("n")
f = C("f")
e = D("e")
j = E("j")
g = F("g")
m = G("m")
l = D("l")
c = E("c")
a = A("a")

d.p = g
n.o = g
n.p = g
n.t = f
f.p = m
f.z = m
f.r = g
f.w = n
f.v = l
e.y = f
j.q = l
j.t = n
j.y = c
g.v = n
g.t = c
g.u = m
m.s = f
l.y = f
c.q = l
c.t = n
c.y = j
a.p = g
assert e.y.v.y.r.v.o.t.q.y.txt == "f"