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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: G = None
        self.y: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: G = None
        self.y: D = None
        self.x: C = None
        self.txt = txt

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

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

j.y = h
j.r = h
l.t = j
l.p = e
l.u = n
l.y = h
d.o = e
d.t = e
d.p = e
d.r = j
c.p = j
e.w = h
h.q = d
h.x = d
h.v = n
h.y = c
n.u = e
assert c.p.r.x.txt == "d"