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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: A = None
        self.s: D = None
        self.v: D = None
        self.x: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

n = A("n")
h = B("h")
a = C("a")
c = D("c")
d = E("d")
b = F("b")
g = A("g")

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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: A = None
        self.s: D = None
        self.v: D = None
        self.x: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

n = A("n")
h = B("h")
a = C("a")
c = D("c")
d = E("d")
b = F("b")
g = A("g")

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