class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: A = None
        self.p: A = None
        self.s: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: D = None
        self.p: E = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: B = None
        self.p: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: A = None
        self.v: B = None
        self.z: F = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: A = None
        self.p: A = None
        self.s: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: D = None
        self.p: E = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: B = None
        self.p: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: A = None
        self.v: B = None
        self.z: F = None
        self.txt = txt

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

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

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