class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: D = None
        self.q: E = None
        self.y: E = None
        self.u: G = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: D = None
        self.q: E = None
        self.y: E = None
        self.u: G = None
        self.txt = txt

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

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

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

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

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

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