class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: D = None
        self.t: F = None
        self.o: G = None
        self.w: F = None
        self.txt = txt

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

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

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

d.u = f
d.r = c
n.q = j
n.y = f
c.o = f
c.q = b
c.t = m
f.y = m
m.v = n
m.y = f
m.t = j
m.w = j
m.o = b
j.y = n
b.x = f
b.r = f
b.t = f
b.p = m
b.w = c
assert j.y.q.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: D = None
        self.t: F = None
        self.o: G = None
        self.w: F = None
        self.txt = txt

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

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

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

d.u = f
d.r = c
n.q = j
n.y = f
c.o = f
c.q = b
c.t = m
f.y = m
m.v = n
m.y = f
m.t = j
m.w = j
m.o = b
j.y = n
b.x = f
b.r = f
b.t = f
b.p = m
b.w = c
assert j.y.q.y.y.txt == "f"